Skip to content

Traces dont show path, only shows method #3680

Answered by tommy-ww
tommy-ww asked this question in Q&A
Discussion options

You must be logged in to vote

I figured out a way to do this.

You can use getNodeAutoInstrumentations OR use HttpInstrumentation and ExpressInstrumentation independently.

const sdk = new opentelemetry.NodeSDK({
  traceExporter,
  instrumentations: [
    getNodeAutoInstrumentations({
      '@opentelemetry/instrumentation-http': {
        responseHook: (span, info) => {
          span.updateName(`${info.req.method}: ${info.req.url}`);
        }
      }
    })
  ],
  resource: new Resource({
    [SemanticResourceAttributes.SERVICE_NAME]: `mktg-${serviceName}-${env}`
  })
});

Independently

  traceExporter,
  instrumentations: [
    new HttpInstrumentation({
      responseHook: (span, info) => {
        console.log(info.r…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@excalq
Comment options

@tommy-ww
Comment options

Answer selected by tommy-ww
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants