You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Koa, a middleware can throw exceptions and this exception can be handled by another middleware to return an error message in the response. The @opentelemetry/koa-instrumentation plugin creates a new span for each Koa middleware, wraps the actual middleware call and once this async call is over, it calls span.end().
When an exception happens in the middlewareLayer, I expect the Koa plugin to account for it, mark the span for the middleware with an error by calling span.recordException(err), end the span, and then re-throw the exception.
This would be similar to what other plugins do. Below is an example from the graphql instrumentation plugin:
Because of the uncaught exception, a span.end() call is never made, so the span is completely missing.
I can gladly come up with a pull request using the safeExecuteInTheMiddle utility function, if you think the solution should be similar to what I expect to see.
The text was updated successfully, but these errors were encountered:
What version of OpenTelemetry are you using?
Versions 0.12.0 and 0.13.0
What version of Node are you using?
Node 12.20.0
What did you do?
In Koa, a middleware can throw exceptions and this exception can be handled by another middleware to return an error message in the response. The
@opentelemetry/koa-instrumentation
plugin creates a new span for each Koa middleware, wraps the actual middleware call and once this async call is over, it callsspan.end()
.opentelemetry-js-contrib/plugins/node/opentelemetry-koa-instrumentation/src/koa.ts
Lines 133 to 136 in f039f1f
What did you expect to see?
When an exception happens in the middlewareLayer, I expect the Koa plugin to account for it, mark the span for the middleware with an error by calling
span.recordException(err)
, end the span, and then re-throw the exception.This would be similar to what other plugins do. Below is an example from the graphql instrumentation plugin:
opentelemetry-js-contrib/plugins/node/opentelemetry-instrumentation-graphql/src/graphql.ts
Lines 213 to 223 in f039f1f
What did you see instead?
Because of the uncaught exception, a
span.end()
call is never made, so the span is completely missing.I can gladly come up with a pull request using the
safeExecuteInTheMiddle
utility function, if you think the solution should be similar to what I expect to see.The text was updated successfully, but these errors were encountered: