Span
as the active instance for the current
context (usually a thread).ScopeManager.activate(Span)
instead.
Set the specified Span
as the active instance for the current
context (usually a thread).
Finishing the Span
upon Scope.close()
is discouraged,
as reporting errors becomes impossible:
try (Scope scope = tracer.scopeManager().activate(span, true)) {
} catch (Exception e) {
// Not possible to report errors, as
// the span has been already finished.
}
Span
instance active for the current context (usually a thread).Span
.Scope
, updating ScopeManager.active()
and ScopeManager.activeSpan()
in the process.SpanContext
extraction.References.CHILD_OF
reference to the ScopeManager.active()
).SpanContext
injection.Binary
instance used for injection with the
specified ByteBuffer as output.ScopeManager
interface abstracts both the activation of Span
instances via
ScopeManager.activate(Span, boolean)
and access to an active Span
/Scope
via ScopeManager.active()
.Span.setTag(String, String)
, but for boolean values.Span.setTag(String, String)
, but for numeric values.Span.setTag(String, String)
, but with using TagSpan
directly or access it through ScopeManager.activeSpan()
Return the corresponding active Span
for this instance.Span
represents the OpenTracing specification's Span contract.Span
.Tracer.SpanBuilder.start()
and ScopeManager.activate(Span span)
instead.
Returns a newly started and activated Scope
.
SpanBuilder#startActive()
is a shorthand for
tracer.scopeManager().activate(spanBuilder.start())
.
The returned Scope
supports try-with-resources, but using this method is
discouraged as the Span
reference could be easily lost, and reporting
errors on Span
through this method becomes impossible:
try (Scope scope = tracer.buildSpan("...").startActive(true)) {
// (Do work)
scope.span().setTag( ... ); // etc, etc
} catch (Exception e) {
// Not possible to report errors, as
// the span reference has been lost,
// and span has been already finished too.
}
It is recommended to use Tracer.SpanBuilder.start()
with a subsequent call to
ScopeManager.activate(Span)
Span span = tracer.buildSpan("...").start();
try (Scope scope = tracer.activateSpan(span)) {
} catch (Exception e) {
span.log(...); // Report any errors properly.
} finally {
span.finish(); // Optionally close the Span.
}
Tracer.SpanBuilder.start()
instead.Span.setTag(String, String)
, but for the span being built.Span.setTag(String, boolean)
, but for the span being built.Span.setTag(String, Number)
, but for the span being built.AbstractTag#set(Span, T)
, but for the span being built.Copyright © 2016–2018 OpenTracing. All rights reserved.