Replies: 1 comment
-
I guess the use case to create spans but don't export them was not seen as useful. class NoopSpanExporter implements SpanExporter {
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void {
process.nextTick(resultCallback, ExportResultCode.SUCCESS);
}
shutdown(): Promise<void> {
return Promise.resolve();
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I have my tracing configured as follows in an Express server:
Just basically following the example from the Getting Sarted guide without the tracing exporter. So far, so good.
So in a router controller, if I do:
I expect to see some span printed into the console, but instead I only see
undefined
.If instead, I configure a
tracingExporter
in theNodeSDK
configuration, it actually works:const sdk = new opentelemetry.NodeSDK({ + traceExporter: new opentelemetry.tracing.ConsoleSpanExporter(), resource: new Resource({ [SemanticResourceAttributes.SERVICE_NAME]: 'api', }), instrumentations: [getNodeAutoInstrumentations()] })
And I don't understand why this is the correct behavior, what if I don't want to export the traces anywhere, can I get spans anyway? I found that setting a custom trace provider also does the trick:
const sdk = new opentelemetry.NodeSDK({ resource: new Resource({ [SemanticResourceAttributes.SERVICE_NAME]: 'api', }), instrumentations: [getNodeAutoInstrumentations()] }) + sdk.configureTracerProvider({}, new NodeTracerProvider().getActiveSpanProcessor())
But I am not sure which is the best solution for my case right now. I want to use spans to attach the tracing id to logs, so afterward when we start tracing we can link logs with traces.
Beta Was this translation helpful? Give feedback.
All reactions