graphql

István Karaszi 2024-11-05T09:50:43.440799Z

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?

2024-11-05T16:50:26.260179Z

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?

István Karaszi 2024-11-06T07:51:30.050409Z

Yeah, we have Prometheus exporter already.

István Karaszi 2024-11-06T07:51:56.953479Z

Of course I could do the wrapping, but I wanted to do that in a more generic way

hlship 2024-11-19T15:56:39.944839Z

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.

István Karaszi 2024-11-19T16:16:30.783379Z

We solved the problem differently at the end. So we have a working solution in place. Thank you!

orestis 2024-11-13T15:26:39.845139Z

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.

➕ 1
2024-11-06T11:48:21.017539Z

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.