Skip to content

examples/express can not work? #2949

@iksars

Description

@iksars

What version of OpenTelemetry are you using?

"dependencies": {
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.54.2",
"@opentelemetry/instrumentation": "^0.54.2",
"@opentelemetry/instrumentation-express": "^0.44.0",
"@opentelemetry/instrumentation-http": "^0.54.2",
"@opentelemetry/resources": "^1.27.0",
"@opentelemetry/sdk-trace-base": "^1.27.0",
"@opentelemetry/sdk-trace-node": "^1.27.0",
"@opentelemetry/semantic-conventions": "^1.27.0",
"axios": "^1.6.0",
"express": "^4.17.1"
}

What version of Node are you using?

v20.16.0

What did you do?

I try to run examples/express in this repo locally.

What did you expect to see?

Http and express should be auto-instrument and send traces data to my observability backend.

What did you see instead?

I just can not see any traces data. The instrument doen't work.

Additional context

the orign code in server.ts is:

import { setupTracing } from './tracer';

// Require in rest of modules
import * as express from 'express';
import * as axios from 'axios';
import { RequestHandler } from 'express';

setupTracing('example-express-server');

after I adjust the order of instrument like this, it works:

import { setupTracing } from './tracer';

setupTracing('example-express-server');

// Require in rest of modules
import * as express from 'express';
import * as axios from 'axios';
import { RequestHandler } from 'express';

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpkg:instrumentation-expresspriority:p4Bugs and spec inconsistencies which do not fall into a higher prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions