[instrumentation-express] http.route == "/"
if every path matches
#1947
Labels
bug
Something isn't working
pkg:instrumentation-express
priority:p4
Bugs and spec inconsistencies which do not fall into a higher prioritization
What version of OpenTelemetry are you using?
@opentelemetry/instrumentation-express: 0.35.0 (The issue is about this dependency)
@opentelemetry/instrumentation-http: 0.48.0
@opentelemetry/sdk-node: 0.48.0
@opentelemetry/sdk-trace-node: 1.21.0
What version of Node are you using?
20.11.0
What did you do?
Send any request to the server (or an OPTIONS request for the example in the comment).
Here is a repo with more and other (see Additional context) examples, with spans being printed to console: otel-express-routes
What did you expect to see?
For the root span something like:
What did you see instead?
Since
name
depends onhttp.route
, this is really only about the latter.Additional context
http.route == "/"
) can be observed for root spansapp.use
orapp.<METHOD>
http.route == "/"
, when matching every path; e.g.app.use(router)
.app.use('/abc', router1);
this leads tohttp.route == "/abc"
for corresponding router spans, but "/abc" and "abc/*" routes are being matched. "/abcd" or similar is not matched.What to do about it?
Looking at HTTP Server semantic conventions and Express 4 routing (plus testing a lot of paths), I think the following could be good alternatives for the cases mentioned above, because they match actual Express routing behavior, as expressed in Express 4 syntax.
I don't have any prior experience with OTel semantic conventions, though. What do you think?
I have these changes (using "*" and "(/*)?") running locally and would be happy to provide a PR. I would just have to try and break it a bit more and have a look at extending the tests to cover these cases.
My current changes would also remove double slashes (#1547), but this option would work just as well well for that, I think.
The text was updated successfully, but these errors were encountered: