Skip to content

Instantly share code, notes, and snippets.

@vietj
Created January 31, 2019 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vietj/8485fd7d53e38ae54a143ce29c3d1282 to your computer and use it in GitHub Desktop.
Save vietj/8485fd7d53e38ae54a143ce29c3d1282 to your computer and use it in GitHub Desktop.
public Scope receiveRequest(Map<Object, Object> context, Object request, String operation, Iterable<Map.Entry<String, String>> headers, Iterable<Map.Entry<String, String>> tags) {
SpanContext sc = tracer.extract(Format.Builtin.HTTP_HEADERS, new TextMap() {
@Override
public Iterator<Map.Entry<String, String>> iterator() {
return headers.iterator();
}
@Override
public void put(String key, String value) {
throw new UnsupportedOperationException();
}
});
Tracer.SpanBuilder builder = tracer.buildSpan(operation);
if (sc != null) {
builder = builder.asChildOf(sc);
}
builder
.ignoreActiveSpan()
.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER)
.withTag(Tags.COMPONENT.getKey(), "vertx");
Scope scope = builder.startActive(false);
reportTags(scope.span(), tags);
scope.close();
context.put(ACTIVE_SCOPE, scope);
return scope;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment