ariadne icon indicating copy to clipboard operation
ariadne copied to clipboard

ApolloTracing in federation is not supported

Open nilansaha opened this issue 3 years ago • 9 comments

I believe that apollotracing extension we have is not using the correct specs. It seems the tracing should be base64 encoded on protobuf and then put as value to the key ftv1 under extensions as described here https://www.apollographql.com/docs/federation/metrics/

Right now it just returns a json with the key tracing under extensions so apollo fails to parse it

nilansaha avatar Jun 16 '21 16:06 nilansaha

The docs you are linking to seems to be only for federations.

We only support ApolloTracing v1 where tracing report is returned under extensions key for GraphQL playground to ingest and display. If they've released other versions of spec in the meantime (and they likely did seeing how they are monetizing this with Apollo Studio), new version of tracing extension will have to be implemented.

Some thing probably would have to be done tracing in federations.

rafalp avatar Jun 16 '21 16:06 rafalp

Do you have any plans to implement this then considering Apollo is such a big player and I assume its going to be useful for a lot of people.

nilansaha avatar Jun 16 '21 16:06 nilansaha

Not at the moment, I'm afraid.

But pull request is always welcome - if problem really is just different key to use in extensions, it should be simple enough to contribute.

rafalp avatar Jun 16 '21 17:06 rafalp

Thanks for the comment. Well its more than that. The spec is slightly bit different. Will post any updates here if I do have the time to do it myself

nilansaha avatar Jun 16 '21 17:06 nilansaha

FYI - I built a working implementation that I am using on my team right now that follows Apollo's new spec with protobuff but its not exhaustive in any sense (it only sends fields traces but nothing related to errors). But while working on it I stumbled across another potential issue that exists in the default Apollotracing extension in Ariadne which is documented here If I could get some clarification that would be great. I could probably upstream some stuff once I figure everything out

nilansaha avatar Jun 17 '21 17:06 nilansaha

@rafalp I am really diving into the tracing part and I have a question which is kinda related. Can you confirm that this line is kind of a proxy check if its a default resolver or not. To me it seems it just checks if there is a resolver set for that field. If not then we can assume it is a default resolver there obviously because that segment of the field is still being resolved and run. So why two separate checks one with the line and another with is_default_resolver(resolver). I feel that line should be part of the is_default_resolver function

nilansaha avatar Jun 19 '21 23:06 nilansaha

Hi @nilansaha @rafalp Phil from Apollo here 👋 ... would love to collaborate on helping get federation tracing support added to ariadne if you like. What can we do to help?

cc @abernix @mandiwise @michael-watson

prasek avatar Jun 24 '21 18:06 prasek

Hello @nilansaha and @rafalp, I'm also from Apollo and have an example of basic support for federated tracing implemented via an Ariadne extension here:

https://github.com/apollosolutions/ariadne-federated-traces

I mostly write Python on a recreational basis only, so I'm sure it can be improved upon. But hopefully the code will be a useful point of reference for you. The InlineTraceExtension class is based on Apollo Server's ApolloServerPluginInlineTrace class (as well as the related TraceTreeBuilder class). Those classes provide a nearly line-for-line re-implementation of the Node plugin in Python.

mandiwise avatar Jun 25 '21 21:06 mandiwise

Hi @prasek and @mandiwise, thank you so much for reaching out and providing example implementation! ❤️

I'll bring this up on our side next week so we can discuss where we want to go with that.

rafalp avatar Jun 27 '21 22:06 rafalp

@rafalp , looks like this might be the last bit to make ariadne support Federation V2 fully... the sample implementation looks ok, should we test it against the performance benchmarks?

itamar82 avatar Nov 03 '22 13:11 itamar82

Closing this. We are following in Apollo's steps and deprecating Apollo Tracing in next release. Apollo's recommendation in tracing repo is to use new Apollo Studio format or OpenTelemetry, which we are also adding in next release

We suggest that people looking for formats for describing performance traces consider either the Apollo Studio protobuf-based trace format or a more generic format such as OpenTelemetry.

rafalp avatar Jun 06 '23 16:06 rafalp