Skip to content

Commit 9910682

Browse files
committed
chore: return original layer result
1 parent 3b1e1e5 commit 9910682

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

plugins/node/opentelemetry-plugin-koa/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@
4444
"@opentelemetry/context-async-hooks": "0.9.0",
4545
"@opentelemetry/node": "0.9.0",
4646
"@opentelemetry/tracing": "0.9.0",
47+
"@types/koa": "^2.11.3",
4748
"@types/mocha": "7.0.2",
4849
"@types/node": "12.12.47",
4950
"@types/shimmer": "1.0.1",
5051
"codecov": "3.7.0",
5152
"gts": "2.0.2",
53+
"koa": "^2.13.0",
5254
"mocha": "7.2.0",
5355
"nyc": "15.1.0",
5456
"rimraf": "3.0.2",
@@ -61,8 +63,6 @@
6163
"dependencies": {
6264
"@opentelemetry/api": "^0.9.0",
6365
"@opentelemetry/core": "^0.9.0",
64-
"@types/koa": "^2.11.3",
65-
"koa": "^2.13.0",
6666
"shimmer": "^1.2.1"
6767
}
6868
}

plugins/node/opentelemetry-plugin-koa/src/koa.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class KoaPlugin extends BasePlugin<typeof koa> {
7777

7878
}
7979

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

97-
oldMiddleware(context, next);
97+
var result = middlewareLayer(context, next);
9898
mwSpan.end();
99+
return result;
99100

100101
}
101102
return patchedLayer;

0 commit comments

Comments
 (0)