Add ability to control metric output level through spin_telemetry cargo feature#3619
Add ability to control metric output level through spin_telemetry cargo feature#3619rylev wants to merge 1 commit into
Conversation
…go feature Signed-off-by: Ryan Levick <rlevick@akamai.com>
|
It would be a larger change but I'd be inclined to switch metrics to use opentelemetry directly rather than through the wonky |
| Ok(MetricsLayer::new(meter_provider)) | ||
| } | ||
|
|
||
| // The two mutually exclusive features cannot both select a default level. |
There was a problem hiding this comment.
FWIW we do already have cfg-if in the dep tree...
Looking forward to bumping the MSRV too.
| #[cfg(all( | ||
| feature = "metrics-default-level-debug", | ||
| feature = "metrics-default-level-info" | ||
| ))] | ||
| compile_error!( | ||
| "features `metrics-default-level-debug` and `metrics-default-level-info` are mutually exclusive" | ||
| ); |
There was a problem hiding this comment.
Given that these are sort of "logically additive" it would be nice to treat this the same as just enabling metrics-default-level-info so that --all-features doesn't break.
There was a problem hiding this comment.
...though annoyingly that already appears to be broken by llm-metal / llm-cublas.
calebschoepp
left a comment
There was a problem hiding this comment.
It would be a larger change but I'd be inclined to switch metrics to use opentelemetry directly rather than through the wonky tracing interface.
I share the same desire, but not blocking of course.
@lann @calebschoepp I'd be fine with this, but that would be a breaking change. Not sure how we want to handle that. |
Breaking change for embedders, or for something else I'm misunderstanding? |
|
Not if they're using the macros! 😅 |
|
For all users of spin. It's not a breaking code change, but if we use opentelemetry directly, users of spin will suddenly start seeing metrics even if they had previously filtered them out with RUST_LOG=info before. |
|
I think you already have to opt-in with env vars don't you? spin/crates/telemetry/src/env.rs Lines 29 to 41 in ae349c2 |
I personally don't see this as a problem. I'd be really surprised if people were explicitly using |
|
I see two approvals but a lot of ongoing discussion. Should I merge this or are folks thinking there is more work/thought needed? |
|
@itowlson I've provided an alternative implementation in #3623 - let's see what @lann and @calebschoepp think |
|
Closing in favor of #3623 |
This gives embedders a way to control at which level telemetry should be emitted at. I think this is the best way to allow metrics which are emitted deep from within Spin's codebase to still be controlled by embedders which may choose to statically strip out traces and would thus never see these metrics.