Hi, the https://cljdoc.org/d/com.github.steffan-westcott/clj-otel-api/0.2.10/api/steffan-westcott.clj-otel.api.metrics.http.server#wrap-metrics-by-route for wrap-metrics-by-route says:
> This middleware should not be used for applications run with the OpenTelemetry instrumentation agent.
What is the correct approach for recording route-level metrics for an application run with the agent?
In the countries-service example, the instrumentation agent maintains the metric http_server_request_duration_seconds_sum . The example uses wrap-compojure-route . Follow the comments in countries_service.clj to start the server and issue some curl requests. By examining the metric with Prometheus on http://localhost:9090/ you can see measurements are populated with the http_route attribute. Without the middleware, this attribute is not populated.
Is it possible to report metrics using only metrics and not traces/spans? My destination does not support traces.
Yes, adding route data will work independently for traces and metrics.
Follow the guide to https://cljdoc.org/d/com.github.steffan-westcott/clj-otel-api/0.2.10/doc/guides#_manually_add_route_data_to_a_server_span. As well as updating the server span, it updates HttpRouteState which is part of the instrumentation agent API. This ensures the http.route attribute is populated on relevant metrics maintained by the agent.
This is only needed if you are not using wrap-route, wrap-reitit-route , wrap-compojure-route or route-interceptor . https://cljdoc.org/d/com.github.steffan-westcott/clj-otel-api/0.2.10/doc/guides#_work_with_http_client_and_server_spans covers use of these particular middleware and interceptor.
OK, I'm getting some time to come back to this work after the holidays.
After having added wrap-compojure-route to my middleware, what is a an example of a metric I might expect to see?