graphql-hive / console

Hive Console is a GraphQL platform: schema registry, analytics and gateway for GraphQL federation and other GraphQL APIs
https://the-guild.dev/graphql/hive
MIT License
425 stars 101 forks source link

Adding more context to "failed to collect operation" errors #1227

Open rperryng opened 1 year ago

rperryng commented 1 year ago

Hey there 👋

This is related to / a follow-up https://github.com/kamilkisiela/graphql-hive/issues/1220

Perhaps I'm missing something but is there any way to enrich these error log messages with more context? I know that the logger can be supplied at startup but I'm looking to add some dynamic/runtime context related to the currently executing request, maybe similar to how envelop offers a useErrorHandler configuration

In our personal circumstance we use an apollo koa server, and we keep a KoaContext with a requestId on it that gets generated by the client - this lets us track requests across our ecosystem of microservices. Ideally, we would love to enrich the error thrown here with our context. This way, any error can be easily associated with the particular HTTP request logs that triggered the error

At the very least, it would be great if the error call included the query document that it was trying to parse.

asher-dutchie commented 2 months ago

Pardon the slight detraction but how do you configure the logger on startup?