best practices : should we reuse the instruments ? #2783
-
I am using the below code to record the time taken for a function. but I am creating histogram instrument for every request.
so I try to do something like this
But I am getting type mismatch error
these are my dependencies Qs :
thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Create once and re-use. If not easy to pass around the created instance, clone and share. (Cloning is cheap and will point to the same underlying Metric). |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Create once and re-use. If not easy to pass around the created instance, clone and share. (Cloning is cheap and will point to the same underlying Metric).
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/src/metrics/instruments/histogram.rs#L7-L11