graphql

orestis 2022-01-18T11:02:51.029100Z

Not strictly graphql related but possibly someone in this channel could give me some pointers. I'd like to troubleshoot some performance issues with some of our graphql endpoints. There's obviously the timing extension support right there in Lacinia for one-offs, but I would like to take this as an opportunity to add proper observability (e.g. AWS x-ray, Honeycomb etc). What I'm looking for is to collect various timing data about graphql queries: How long did the root resolver took, how long did the sql backend took for the root resolver, any other N+1 queries that we may be unwittingly firing etc etc.

2022-01-18T12:47:54.029800Z

I did exactly that with X-Ray. It helped us identified several N+1 problems. The Java SDK is quite painful to work with, so I ended up with wrapping it as a clojure library. https://github.com/hden/aws-xray-sdk-clj

orestis 2022-01-18T13:35:25.031400Z

Thanks! Did you end up instrumenting every resolver manually or is there some trick in Lacinia to wrap all resolvers?

orestis 2022-01-18T13:38:34.033Z

Any guidance on how to map segments to graphql? I guess the top level query is the first segment and any child resolvers would be subsegments?

2022-01-18T13:46:55.033200Z

Yes. Depends on how you resolve your result, a context switch might be needed. https://lacinia.readthedocs.io/en/latest/resolve/context.html

orestis 2022-01-18T13:53:23.034Z

Also what could be a useful annotation? Eg resolver args?

2022-01-18T13:55:43.034200Z

You might need to pass the root segment to the field resolvers so that the field resolvers can attach subsegments to the root segment. There are several ways to do so, one is to pass the parent (e.g. root) segment as a part of the application context.

orestis 2022-01-18T14:19:44.035600Z

Right, I was hoping that Lacinia could allow me to do that globally. But I guess I could do that via a defresolver macro or similar.

👍 1
yenda 2022-01-18T16:30:42.035900Z

We've been using pedestal.log tracing with datadog, opening traces in interceptors, and spans around resolvers using a wrapper so that we have the details. It was quite painful tbh because active-span can return a closed span and we ended up with mangled traces. In the end with quite some lifting on our end to completely rely on our own active spans it works ok

orestis 2022-01-18T17:57:34.038200Z

It seems like there's some movement towards standardizing tracing etc with open telemetry but it feels quite early days still. I'll probably go with x-ray for now.

osi 2022-01-18T19:00:24.038400Z

we have our GraphQL endpoint instrumented with Honeycomb. highly recommended.

hlship 2022-01-18T19:21:40.038600Z

I have been thinking about some mechanism where you could provide some kind of "event listener/callback" to Lacinia and it would send you details about what it is doing. That might make it possible to identify what's going on during execution.

👍 2