[HttpInstrumentation] Various http attributes are missing when doing auto-instrumentation ? #4657
-
Hi, I am using NodeSDK and getNodeAutoInstrumentations for generating metrics in node. I am able to get metrics by seems like lot of attributes are missing like http_route, etc.. I could only see:
My code snippet: // ...
const sdk = new NodeSDK({
serviceName: 'my-service',
resource: new Resource({
[SEMRESATTRS_SERVICE_NAMESPACE]: 'application',
[SEMRESATTRS_SERVICE_VERSION]: '0.1',
}),
// traceExporter: new ConsoleSpanExporter(),
spanProcessors: [new BatchSpanProcessor(traceExporter)],
metricReader: prometheusMetricExporter,
instrumentations: [
getNodeAutoInstrumentations({
// only instrument fs if it is part of another trace
'@opentelemetry/instrumentation-fs': {
enabled: false,
},
'@opentelemetry/instrumentation-redis': {
enabled: false,
},
'@opentelemetry/instrumentation-net': {
enabled: false,
},
'@opentelemetry/instrumentation-socket.io': {
enabled: false,
},
'@opentelemetry/instrumentation-http': {
requestHook: (span: Span, request: IncomingMessage) => {
span.setAttribute(SEMATTRS_HTTP_ROUTE, 'hello')
}
}
})
],
resourceDetectors: [envDetector, hostDetector, osDetector, processDetector],
});
sdk.start(); Is there a way to add |
Beta Was this translation helpful? Give feedback.
Answered by
gargut-deshaw
Apr 24, 2024
Replies: 1 comment
-
This is fixed. I had an import which was causing express to be loaded before express instrumentation library. Changing import order worked. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gargut-deshaw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is fixed. I had an import which was causing express to be loaded before express instrumentation library. Changing import order worked.