opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

Can I use auto-instrumentation & manual instrumentation at the same time?

Open floatingstarlight opened this issue 1 year ago • 1 comments
trafficstars

  • [x] This only affects the JavaScript OpenTelemetry library
  • [x] This may affect other libraries, but I would like to get opinions here first

Hi, I'm now developing an full-stack application, and I'm trying to use both auto-instrumentation & manual instrumentation of traces at the same time through openTelemtry, and export my trace information to honeyComb Dashboard.

But it seems that I cannot make both exporting to honeycomb dashboard, but I can export both to ConsoleExporter.

My questions: 1.What might be problems in my case? 2.I've seen we can also create traceProvider to implement custom implementation, what would be the difference between Creating traceProvider vs. sdk-start method?

Here is my implementation:

1.Auto-instrumentation:

new opentelemetry.NodeSDK({
                traceExporter: new OTLPTraceExporter({
                url: 
                headers: {},
                instrumentations: [getNodeAutoInstrumentations()],
            });

3.Custom-instrumentation:

const tracer = opentelemetry.trace.getTracer("backstage-trace");

function(): {
    tracer.startActiveSpan('xxx', (span: Span) => {
    span.end();
}

And when I use consoleExporter, both data can be recorded. But when it comes to honeyComb dashboard, only the auto-Instrumentation data are recorded.

Thanks so much!

floatingstarlight avatar Aug 23 '24 17:08 floatingstarlight