-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NodeSDK support for OTEL_TRACES_EXPORTER, ... #2873
Comments
I'll like to work on this issue please. |
A few questions on
Thanks for any feedback. |
This is what we currently use but it's far from complete function setupTraceExporter(): SpanExporter | undefined {
const exporter = process.env.OTEL_TRACES_EXPORTER ?? 'none'
switch (exporter) {
case 'otlp': {
const protocol =
process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL ??
process.env.OTEL_EXPORTER_OTLP_PROTOCOL ??
'http/protobuf'
switch (protocol) {
case 'http/protobuf':
return new ProtoTraceExporter()
case 'grpc':
return new OTLPTraceExporter()
default:
throw new Error(`Unsupported OpenTelemetry protocol ${protocol}`)
}
}
case 'console':
return new opentelemetry.tracing.ConsoleSpanExporter()
case 'none':
// we can't use pino here, otherwise it will not be instrumented
console.log('Tracing disabled.')
return undefined
default:
throw new Error(
`OpenTelemetry OTEL_TRACES_EXPORTER invalid value: ${exporter}`,
)
}
} |
There is a section on the default protocol for otlp:
|
Yes, i originally implemented few exporters in the PR before removing them because the sdk size.
From our discussion at the time we agreed that we didn't want this into the
Doesn't the spec precise a default |
Ah yes I see it now. @francisdb provided a link to it above - I must have missed. The default is |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Still working on this |
I believe these environment variables are (also) useful for the inverse: to have no effect when not provided, and to disable the traces or metrics ( or future logs) exporter that's configured in code. const sdk = new NodeSDK({
metricExporter,
traceExporter, & OTEL_METRICS_EXPORTER=none |
Any update on this please @svetlanabrennan. If not could you please assign the issue to someone more capable? |
Please do not disparage contributors. A small handful of people are spread very thin over a large project. If you want to know the status of an issue you can ask if there is any update but criticizing the ability of contributors will not be tolerated. |
Hi @dyladan, |
@UdyW As you can see in the issue itself (one comment prior to yours) a PR has been opened one month ago: #3143 and if you check it there has been activity on it last week. Again, please avoid commenting passive-aggresive thing like |
Is your feature request related to a problem? Please describe.
To consolidate configuration for all our services we would like to configure the node sdk fully through the use of env vars like we do for the java/ruby sdk
see the related specs here:
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#otlp-exporter
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md
Describe the solution you'd like
One example would be the following
that
buildTraceExporterFromEnv
could also be the default for traceExporterIn the code we register a number of exporters we want to support
OTEL_TRACES_EXPORTER=otlp
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://..../v1/traces"
Describe alternatives you've considered
We currently have to do handle the
OTEL_TRACES_EXPORTER
/OTEL_EXPORTER_OTLP_PROTOCOL
to exporter selection manually.Additional context
Current situation:
if you don't set a
traceExporter
on the NodeSDK tracing will be disabledWhen using
BasicTracerProvider
the exporter is configured through OTEL_TRACES_EXPORTER as in the specopentelemetry-js/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts
Lines 251 to 261 in 7870e95
The text was updated successfully, but these errors were encountered: