Which middleware has the bug?
@hono/otel
What version of the middleware?
1.1.2
What version of Hono are you using?
4.12.23
What runtime/platform is your app running on? (with version if possible)
Node.js 24
What steps can reproduce the bug?
A Hono app uses @hono/otel around an adapter route such as /rpc/*. A downstream RPC adapter resolves the actual operation and sets http.route on the active span.
Example:
- Hono route:
/rpc/*
- Resolved operation:
/rpc/user/getProfile
- Downstream middleware sets
http.route = "/rpc/user/getProfile"
After the request finishes, @hono/otel runs its finalize step and sets http.route back to routePath(c), which is /rpc/*.
What is the expected behavior?
If downstream middleware changes http.route, @hono/otel should not overwrite it during finalize, or it should provide a config hook for choosing the final route value.
The same final route value should be used for http.server.request.duration, since today that metric also uses routePath(c) directly.
What do you see instead?
The span is finalized with http.route = "/rpc/*", and request duration metrics are also recorded under /rpc/*. All RPC operations behind the adapter route are grouped together even though the actual operation is known during request handling.
Additional information
spanNameFactory does not fully solve this because it only changes the span name. It does not control the final http.route attribute or the request duration metric attributes.
Which middleware has the bug?
@hono/otel
What version of the middleware?
1.1.2
What version of Hono are you using?
4.12.23
What runtime/platform is your app running on? (with version if possible)
Node.js 24
What steps can reproduce the bug?
A Hono app uses
@hono/otelaround an adapter route such as/rpc/*. A downstream RPC adapter resolves the actual operation and setshttp.routeon the active span.Example:
/rpc/*/rpc/user/getProfilehttp.route = "/rpc/user/getProfile"After the request finishes,
@hono/otelruns its finalize step and setshttp.routeback toroutePath(c), which is/rpc/*.What is the expected behavior?
If downstream middleware changes
http.route,@hono/otelshould not overwrite it during finalize, or it should provide a config hook for choosing the final route value.The same final route value should be used for
http.server.request.duration, since today that metric also usesroutePath(c)directly.What do you see instead?
The span is finalized with
http.route = "/rpc/*", and request duration metrics are also recorded under/rpc/*. All RPC operations behind the adapter route are grouped together even though the actual operation is known during request handling.Additional information
spanNameFactorydoes not fully solve this because it only changes the span name. It does not control the finalhttp.routeattribute or the request duration metric attributes.