Closed marcosuma closed 1 year ago
Hey @marcosuma! Yes, you should be able to write a plugin for your use case. At Movio, we use AWS X-Ray for tracing so we've developed a plugin for it. I've created a gist for you to have a look at the code: https://gist.github.com/nmaquet/0c04308d7ae7c234387926cf4c7e791c
As you can see from the X-Ray plugin, most of the heavy lifting happens in Init
, WrapGraphQLClientTransport
and InterceptRequest
. I'm quite confident you should be able to use a very similar approach for a Datadog plugin.
Thanks @nmaquet! That helps a lot. Is there a way I can get access to GraphQL errors in a plugin? What I would basically like to do is to trace those errors and publish metrics about it. Current situation is that if I capture the body response with a http.RoundTripper
whenever there is an error the response.body is actually empty (here's a gist about it)
Hey @marcosuma. If you want easy access to GraphQL errors, the Plugin
interface needs to be extended a bit. I've done so here: https://github.com/movio/bramble/pull/205 Can you give this a shot and we'll try and merge this and release it soon.
That's awesome! I can try to clone it and test it locally, but are you plannign to release a new version?
@marcosuma Yes, that's the plan. Could you test it on your side and let me know whether this works for you? Once you confirm that you've tested it, we'll do a release. Thanks!
I did a quick test on how to integrate it with dd-trace and it seems working. This is a way I am trying to use it https://gist.github.com/marcosuma/e3b0e095b11f1dfff09f6ad24c349bf3
FYI I am not fully able to test the whole end-to-end path until this is released as a new version. But LGTM!
Thanks for confirming @marcosuma. I've released https://github.com/movio/bramble/releases/tag/v1.4.8
Closing this issue @marcosuma. Feel free to ask additional question if you have them, though.
Hi there (again) :), our infra uses Datadog to monitor our services. I recently noticed that for our bramble-based service we are using an http tracer but this has the advantage that it'll not correctly log request errors (graphql always returns 200).
So I noticed that the same Datadog library supports graph-gophers - see the example tab for how to use it - which would likely be ideal for us in order to get proper graphql monitoring.
The problem is that I am not sure this could be bundled into our bramble-based service. Could a plugin be used? I tried with the Init method but no luck.