Prometheus metrics for Lacinia I would like to add some visibility to the queries that our backend executes. I saw that there is a https://github.com/walmartlabs/lacinia/blob/99d71e17344577bb71f48b03aa88d22853be6277/docs/tracing.rst#L9 but I also saw that that “Tracing should never be enabled in production.“. So I was wondering if I would only need to know the handler namespace and the execution time what would be my options?
Supposing your app already has a Prometheus exporter? Could you wrap the Lacinia handlers with something that updated counters that the Prometheus exporter would export?
Yeah, we have Prometheus exporter already.
Of course I could do the wrapping, but I wanted to do that in a more generic way
The tracing-enabled flag is not related to Prometheus or any other metrics container; Lacinia collects its own tracing data while it executes a query and includes it as extra data in the response.
We solved the problem differently at the end. So we have a working solution in place. Thank you!
The way we are doing this, is that we wrap at the http layer, via a log-graphql function that does a bit of introspection and logs time taken, the number of bytes etc, together with the top-level query names plus args.
I hadn't been aware of a pattern of 1 handler per namespace. A count per query field path redeemed could help document test-coverage or service-enjoyment.