Traces using opentelemetry SDK to EDOT collector does not show the url path

I’m trying opentelemetry in elasticstack, currently i’m using this: OpenTelemetry node js SDK → EDOT collector → Elasticsearch

For sdk, i use autoinstrumentation using opentelemetry operator. For EDOT collector, I used the default config provided by elastic documentation.

The traces appears in the UI, but it is missing url path:

When clicking the trace for detail, some display path and some not:

I think the span name is also different. The span with path has the span.name with the path, while the one with ‘GET’ Only has span.name with ‘GET’

Is this normal behavior?

Kibana version: 9.1

Elasticsearch version: 9.1

Hi @mikhatanu, this can be the normal behavior for OpenTelemetry JS instrumentations, yes. According to the OpenTelemetry spec for HTTP span names by default the span name should just be the HTTP method (e.g. GET or PUT) unless it can be known that the span name will be low cardinality (i.e. won't have possibly 1000s of different values).

The url path is collected as part of the span. If you click on one of those "GET" spans in the trace view, a side panel will open. Search for "url.path" in the attributes.

The way one can get low cardinality information about the URL path is if the app uses a web framework and defines "routes". So, for example, if your application is using a framework like Express or Fastify, e.g.:

const app = express();
app.get('/ping', (_req, res) => {
    res.send('pong');
});
app.get('/hi/:name', (req, res) => {
    res.send(`Hi, ${req.params?.name || 'buddy'}.`);
});

Then OpenTelemetry instrumentation for those frameworks will automatically get the route into the span name. The result would be that you see span names like GET /hi/:name or somelike that depending on the app's configured routes.