Hi! I have an odd issue with the time metrics are displayed to have been collected at in Aspire.Dashboard. With the following code, I get an exemplar at the correct time, but the graph shows the "bump" of the value at what appears to be the time my application was started. Repeatedly recording measurements changes the "bump" (which stays at the same time, just changes height) and adds additional exemplars (at the correct time).
(require '[java-time.api :as t])
(require '[steffan-westcott.clj-otel.api.metrics.instrument :as instrument])
(defonce ^:private my-duration
(delay (instrument/instrument {:name "my.duration"
:instrument-type :histogram
:unit "s"
:description "Time between task queued and executed."
::explicit-bucket-boundaries-advice (for [i (range 10)]
(+ 30 (* i 10)))})))
(defn my-fun
[^String resource-id ^java.time.Instant started-at]
(instrument/record! @my-duration {:value (-> (t/duration started-at (t/instant))
(t/as :seconds))
:attributes {:resource-id resource-id}}))
Did anyone else notice such oddity? Any idea what might be wrong? Am I using clj-otel wrongly?
I am collecting and displaying the metrics with https://github.com/dotnet/aspire/tree/main/src/Aspire.Dashboard 9.0.0.Different application run, 2 task runs created 2 exemplars, but value still shown in the wrong place of the graph.
I can think of two things that may cause the unwanted behaviour:
• If my-fun is called lazily, using t/instant may not give the expected result
• On the other hand, if you are sure the exemplars are correct, the configuration of the telemetry backend to display the percentile line graphs may need attention. I found the configuration of graphs in the clj-otel The Grafana/Prometheus examples were quite tricky to get right. In particular, I found that I needed to run the examples for a few minutes before the graphs for rate metrics displayed correctly.