Skip to content

Commit

Permalink
add statusCode for APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Oct 18, 2024
1 parent f61d767 commit 1e2e11e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/meteor/app/api/server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,13 @@ export class APIClass<TBasePath extends string = ''> extends Restivus {
if (span) {
this.response.setHeader('X-Trace-Id', span.spanContext().traceId);
}
return (
(await DDP._CurrentInvocation.withValue(invocation as any, async () => originalAction.apply(this))) || API.v1.success()
);

const result =
(await DDP._CurrentInvocation.withValue(invocation as any, async () => originalAction.apply(this))) || API.v1.success();

span?.setAttribute('status', result.statusCode);

return result;
},
);

Expand Down

0 comments on commit 1e2e11e

Please sign in to comment.