Skip to content

Commit

Permalink
Make work
Browse files Browse the repository at this point in the history
  • Loading branch information
nicohrubec committed Jul 31, 2024
1 parent 573965a commit df5aa25
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ test('API route transaction includes nest middleware span. Spans created in and
);
});

await fetch(`${baseURL}/test-middleware-instrumentation`);
const response = await fetch(`${baseURL}/test-middleware-instrumentation`);
expect(response.status).toBe(200);

const transactionEvent = await pageloadTransactionEventPromise;

Expand Down Expand Up @@ -211,7 +212,8 @@ test('API route transaction includes nest guard span and span started in guard i
);
});

await fetch(`${baseURL}/test-guard-instrumentation`);
const response = await fetch(`${baseURL}/test-guard-instrumentation`);
expect(response.status).toBe(200);

const transactionEvent = await transactionEventPromise;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ test('API route transaction includes nest middleware span. Spans created in and
);
});

await fetch(`${baseURL}/test-middleware-instrumentation`);
const response = await fetch(`${baseURL}/test-middleware-instrumentation`);
expect(response.status).toBe(200);

const transactionEvent = await transactionEventPromise;

Expand Down Expand Up @@ -211,7 +212,8 @@ test('API route transaction includes nest guard span and span started in guard i
);
});

await fetch(`${baseURL}/test-guard-instrumentation`);
const response = await fetch(`${baseURL}/test-guard-instrumentation`);
expect(response.status).toBe(200);

const transactionEvent = await transactionEventPromise;

Expand Down
8 changes: 4 additions & 4 deletions packages/node/src/integrations/tracing/nest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class SentryNestInstrumentation extends InstrumentationBase {
const [req, res, next, ...args] = argsUse;
const prevSpan = getActiveSpan();

startSpanManual(
return startSpanManual(
{
name: target.name,
attributes: {
Expand All @@ -172,10 +172,10 @@ export class SentryNestInstrumentation extends InstrumentationBase {

if (prevSpan) {
withActiveSpan(prevSpan, () => {
Reflect.apply(originalNext, thisArgNext, argsNext);
return Reflect.apply(originalNext, thisArgNext, argsNext);
});
} else {
Reflect.apply(originalNext, thisArgNext, argsNext);
return Reflect.apply(originalNext, thisArgNext, argsNext);
}
},
});
Expand All @@ -196,7 +196,7 @@ export class SentryNestInstrumentation extends InstrumentationBase {

target.prototype.canActivate = new Proxy(target.prototype.canActivate, {
apply: (originalCanActivate, thisArgCanActivate, argsCanActivate) => {
startSpan(
return startSpan(
{
name: target.name,
attributes: {
Expand Down

0 comments on commit df5aa25

Please sign in to comment.