Skip to content

Instantly share code, notes, and snippets.

@carlosalberto
Last active August 15, 2018 14:36
Show Gist options
  • Save carlosalberto/191788de3014de9245510a7b4610af15 to your computer and use it in GitHub Desktop.
Save carlosalberto/191788de3014de9245510a7b4610af15 to your computer and use it in GitHub Desktop.
Scope scope = null;
try {
scope = tracer.buildSpan("foo").startActive();
} catch (Exception exc) {
Tags.ERROR.set(scope.span(), true);
scope.span().log(ImmutableMap.Builder<String, Object>()
.put("event", "error")
.put("error.object", exc)
.build());
} finally {
if (scope != null) {
scope.close();
// Optionally close Span (if you own it).
scope.span.finish();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment