clj-otel

ppandis 2025-07-10T16:15:08.382149Z

Hello, is there any example of how one can (when collecting metrics automatically) group metrics for an endpoint ignoring path parameters? For example

/hello/:name
should only register as /hello and not as one call per different name.

steffan 2025-07-10T16:32:41.425759Z

The http.route attribute on HTTP server span metrics is a template string, not the URL path. So for the three requests GET /hello/alice GET /hello/bob GET /hello/charlie all would be associated with span metrics with http.route set to /hello/:name

steffan 2025-07-10T16:34:51.301799Z

This is to keep the metric cardinality low. If the attribute took a different value for each name, most telemetry backends would quickly fall over.

1
ppandis 2025-07-10T16:36:57.747109Z

Thank you for the quick reply and sorry but as I've only been experimenting with the project today, is there any link to the documentation about the above? I'm not sure I understand where to look (or not) for the http.route

steffan 2025-07-10T16:52:27.602019Z

To see this in action, the countries-service example in clj-otel is the simplest. After spinning up the server and making some curl requests, use the Prometheus front end to view metric http_server_request_duration_seconds_count. You will note there is a series for each route you queried, each with attribute http_route set to the Compojure template URL e.g. /country/:country-code/population

steffan 2025-07-10T16:53:43.584029Z

I literally just pushed a fix for this a few minutes ago, so you may want to pull changes if you've cloned the clj-otel repo.

ppandis 2025-07-10T16:59:25.825349Z

Thank you, I'll check the code and will try and run the example later!

ppandis 2025-07-10T17:37:39.182309Z

Looks like adding the _trace-http_/_wrap-reitit-route_ was what I was missing.

👍🏼 1