Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
| // Tie the lifetime of the session count instrument to the lifetime of the router | ||
| // by moving it into a no-op layer. | ||
| let instrument = session_count_instrument(); | ||
| router = router.layer(layer_fn(move |service| { | ||
| let _ = &instrument; | ||
| service | ||
| })); |
There was a problem hiding this comment.
The session_count_active instrument is "stored" in an axum::Router instance by moving it into a no-op layer. Another option would be to just have one global instrument for the entire lifetime of the program, but I'm not sure if that would work everywhere we need it to (eg. does it do the right thing across reloads, tests, etc?)
|
CI performance tests
|
| #[derive(Debug)] | ||
| struct SpanLruSizeInstrument { | ||
| value: Arc<AtomicU64>, | ||
| _gauge: ObservableGauge<u64>, | ||
| } |
There was a problem hiding this comment.
As mentioned in the doc comment, this is a hack that kind of mimicks what tracing::info!(value.) was doing (storing the value whenever it is updated, and reading the stored value when requested).
I'm not sure about this metric, should we keep it at all in 2.0?
There was a problem hiding this comment.
I think we should keep it. It's really helpful to debug and could potentially find the root cause of a leak or so.
value.* metrics to gaugesvalue.* metrics to gauges
27a4a08 to
1b4616b
Compare
| #[derive(Debug)] | ||
| struct SpanLruSizeInstrument { | ||
| value: Arc<AtomicU64>, | ||
| _gauge: ObservableGauge<u64>, | ||
| } |
There was a problem hiding this comment.
I think we should keep it. It's really helpful to debug and could potentially find the root cause of a leak or so.
This comment has been minimized.
This comment has been minimized.
Somehow missed this in #6476 <!-- [ROUTER-911] -->
Migrates
tracing::info!(value.)metrics to otel instruments.Notes in comments