GraphQL Support #38913
Replies: 6 comments 7 replies
-
Hey, I've been playing around with getting GraphQL monitoring into Sentry for the Dart/Flutter environment. See the library at https://pub.dev/packages/sentry_link. I've also created an issue for better GraphQL support at #33723. I've "hacked" the stacktrace format to show errors in queries with variables, which works okay-ish. See this screenshot: My main points of interest are:
I'm happy to answer questions if there are any. |
Beta Was this translation helpful? Give feedback.
-
Hi, I am not sure if it matches completely with this topic but I spent quite some time developing this library which is a python-GraphQL mapper for GraphQL clients. https://github.com/dapalex/py-graphql-mapper It works pretty well, I have created an extensive suite of tests to make sure it is stable enough with Github GraphQL API, RapidAPI GraphQL and GeoDBCities API: I have been able to create quite complex queries and mutations. Let me know if it something that can be of interest |
Beta Was this translation helpful? Give feedback.
-
Another Flutter user here 👋 . I'm currently using the excellent work from @ueman and hoping to contribute as well. But it would be fantastic to have this be part of the built-in |
Beta Was this translation helpful? Give feedback.
-
There is already some support in Node for Apollo and GraphQL, but we would still be happy to get more feedback on the extent of the support and for other platforms where there is interest. https://docs.sentry.io/platforms/node/performance/database/opt-in/ |
Beta Was this translation helpful? Give feedback.
-
I've previously instrumented a pretty big GraphQL API with OpenTelemetry to try to understand/track its performance. Some thoughts: TransactionsThrough typical instrumentation, all your GraphQL traffic ends up in a single transaction - a single URL hosts every query and mutation permutation offered by your GraphQL API. Individual requests have very different performance characteristics since queries are arbitrarily constructed. Even though that one transaction ends up being a big bucket of disparate requests, it's still useful to be able to see and monitor the aggregate performance of the entire API when thinking about things like scale (e.g. how many web servers are serving your API). Alternatives to URL for transaction namingIf transactions could be named something other than "URL path" they might not all be grouped into a single transaction, but I wasn't able to find an alternative split that made sense for something like our transaction table.
FWIW I think that collecting metrics by query hash or similar is still really useful (see workflows below), just maybe not as a way to label rows in a transactions table. The span treeThe main thing I cared about seeing in the tree was the resolvers, since that's where the vast majority of the execution time comes from. Most slow resolvers are slow because they're doing database queries or HTTP calls, so having the spans we we typically auto-instrument as children of the resolver spans is of course useful too. Closely tied to resolvers, and also important to see in the tree, are dataloaders. Usually you end up with many resolver spans that are all dependent on a single dataloader span finishing. This is hard to represent in the tree when spans only have a single parent - what's the parent of a dataloader span? Ideally it's all the resolvers that fed into it. (Note: see span links in OpenTelemetry for potential data model). Being able to show that in the tree somehow would be very useful. Further, resolver spans waiting on a dataloader can look like they're long operations, but really they're doing nothing waiting for the dataloader to finish. Being able to distinguish between when a resolver is working and when it is waiting would also go a long way to understanding a GraphQL query's span tree. Ideal WorkflowsResolversResolvers are the most consistent unit for understanding GraphQL API performance. I want to monitor them directly - how often are they called? What are their performance characteristics? This is analogous to how you'd monitor API endpoints in a REST API in my opinion. GraphQL doesn't return results until all resolvers have finished - so your slowest resolver also serves as the lower bound on how quickly a query involving that resolver can return. (Note: this is a pretty clear span indexing use case). Being able to show representative queries/transactions that use a given resolver would also be useful for context. DataloadersSimilar to resolvers above. Slow dataloaders slow down any resolvers that use them; understanding and monitoring their performance directly can make sense. Aggregate performance of subsets of transactionsIn addition to the aggregate performance of the GraphQL endpoint as a whole, it's nice to be able to see the aggregate performance of some subset of your queries. Examples:
Slowest queriesIt's nice to know flat out what is the worst stuff people are sending us. (If I clicked into a slow query, it would also be nice if we pulled the performance characteristics of that query in general for comparison - did I find an outlier or is this always slow? Is this the only time anyone has made this query, or is it common?) Frequently slow queriesSimilar to slowest queries, if I could get prompted with "here is stuff that's frequently called and also slow", those are usually higher value things to fix. Query complexity tuningSome GraphQL APIs use query complexity as a means to rate limit or prevent excessively large queries. Being able to confirm that the complexity scores of queries actually roughly correspond with their runtime or resource use would be amazing. Other stuffI haven't used Subscriptions much, but helping users understanding their performance would be interesting too. |
Beta Was this translation helpful? Give feedback.
-
#33723 is closed for GraphQL Client errors, next step is for Transactions/Spans. |
Beta Was this translation helpful? Give feedback.
-
Starting a thread to gauge interest in first class graphql support. Please upvote / comment if you'd like to see this happen.
Some things to kick off
Beta Was this translation helpful? Give feedback.
All reactions