Skip to content

Commit

Permalink
Add shouldStart() call to armeria server instrumentation (#4843)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek committed Dec 8, 2021
1 parent b5516c8 commit 8d65542
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ final class OpenTelemetryService extends SimpleDecoratingHttpService {

@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
Context context = instrumenter.start(Context.current(), ctx);
Context parentContext = Context.current();
if (!instrumenter.shouldStart(parentContext, ctx)) {
return unwrap().serve(ctx, req);
}

Context context = instrumenter.start(parentContext, ctx);

Span span = Span.fromContext(context);
if (span.isRecording()) {
Expand Down

0 comments on commit 8d65542

Please sign in to comment.