open-telemetry / opentelemetry-operator

Kubernetes Operator for OpenTelemetry Collector
Apache License 2.0
1.16k stars 414 forks source link

Capability to specify options for specific nodejs instrumentations #3169

Open fujin opened 1 month ago

fujin commented 1 month ago

Component(s)

auto-instrumentation

Describe the issue you're reporting

I have a nodejs codebase which auto instrumentation is working in.

Some of the instrumentation libraries have instrumentation options which we'd like to toggle on. How do we do this correctly, co-existing, when using injected node auto-instrumentation?

e.g.

 instrumentations: [
    getNodeAutoInstrumentations({
      '@opentelemetry/instrumentation-pg': {
        enhancedDatabaseReporting: true,
      },
      '@opentelemetry/instrumentation-graphql': {
        mergeItems: true,
        ignoreTrivialResolveSpans: true,
      },
    }),
jaronoff97 commented 1 month ago

right now this may be difficult because we utilize the upstream get autoinstrumentations method. I'm not sure of the best way to go about allowing setting these options... if they could be set via an environment variable that would be ideal. If not, you could also build you own version of the autoinstrumentation container with those options set at which point you could swap the image the operator uses.