Skip to content

Commit

Permalink
chore: return original layer result
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinee21 committed Jul 6, 2020
1 parent 3b1e1e5 commit 9910682
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-koa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@
"@opentelemetry/context-async-hooks": "0.9.0",
"@opentelemetry/node": "0.9.0",
"@opentelemetry/tracing": "0.9.0",
"@types/koa": "^2.11.3",
"@types/mocha": "7.0.2",
"@types/node": "12.12.47",
"@types/shimmer": "1.0.1",
"codecov": "3.7.0",
"gts": "2.0.2",
"koa": "^2.13.0",
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "3.0.2",
Expand All @@ -61,8 +63,6 @@
"dependencies": {
"@opentelemetry/api": "^0.9.0",
"@opentelemetry/core": "^0.9.0",
"@types/koa": "^2.11.3",
"koa": "^2.13.0",
"shimmer": "^1.2.1"
}
}
5 changes: 3 additions & 2 deletions plugins/node/opentelemetry-plugin-koa/src/koa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class KoaPlugin extends BasePlugin<typeof koa> {

}

private _patchLayer (oldMiddleware: KoaMiddleware) {
private _patchLayer (middlewareLayer: KoaMiddleware) {
const patchedLayer = (context: KoaContext, next: koa.Next) => {
const currentSpan = this._tracer.getCurrentSpan();
if (!currentSpan) {
Expand All @@ -94,8 +94,9 @@ export class KoaPlugin extends BasePlugin<typeof koa> {
mwSpan.setAttribute(AttributeNames.METHOD, context.method);
mwSpan.setAttribute(AttributeNames.KOA_TYPE, 'middleware');

oldMiddleware(context, next);
var result = middlewareLayer(context, next);
mwSpan.end();
return result;

}
return patchedLayer;
Expand Down

0 comments on commit 9910682

Please sign in to comment.