-
Notifications
You must be signed in to change notification settings - Fork 585
Description
What happened?
I'd expect that with this version set and depending on all features to be able to initialise either tonic or http just by leveraging this env var and explecitely set all protocol options.
The defaulting and behaviour dependending on support is pretty clear in the spec
Should there just be a SpanExporter::default()
option?
I instead have to do:
let exporter = match env::var(OTEL_EXPORTER_OTLP_PROTOCOL).unwrap_or(OTEL_EXPORTER_OTLP_PROTOCOL_DEFAULT.to_owned()).as_str() {
"http/json" => {
opentelemetry_otlp::SpanExporter::builder().with_http().with_protocol(Protocol::HttpJson).build()
}
"grpc" => {
opentelemetry_otlp::SpanExporter::builder().with_tonic().build()
}
_ => {
opentelemetry_otlp::SpanExporter::builder().with_http().with_protocol(Protocol::HttpBinary).build()
}
}?;
OpenTelemetry API Version (i.e version of opentelemetry
crate)
opentelemetry-otlp = { version = "0.31", features = ["metrics", "grpc-tonic", "http-json", "http-proto"] }
OpenTelemetry SDK Version (i.e version of opentelemetry_sdk
crate)
opentelemetry_sdk = { version = "0.31.0", features = ["metrics", "rt-tokio", "experimental_metrics_periodicreader_with_async_runtime", "trace"] }
What Exporter(s) are you seeing the problem on?
OTLP
Relevant log output
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1
or me too
, to help us triage it. Learn more here.