@ThreadSafe public final class RecordEventsSpanImpl extends io.opencensus.trace.Span implements ConcurrentIntrusiveList.Element<RecordEventsSpanImpl>
Span class that records trace events.| Modifier and Type | Class and Description |
|---|---|
static interface |
RecordEventsSpanImpl.StartEndHandler
Interface to handle the start and end operations for a
Span only when the Span
has Options#RECORD_EVENTS option. |
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotation(io.opencensus.trace.Annotation annotation) |
void |
addAnnotation(String description,
Map<String,io.opencensus.trace.AttributeValue> attributes) |
void |
addLink(io.opencensus.trace.Link link) |
void |
addMessageEvent(io.opencensus.trace.MessageEvent messageEvent) |
void |
end(io.opencensus.trace.EndSpanOptions options) |
long |
getEndNanoTime()
Returns the end nano time (see
System.nanoTime()). |
io.opencensus.trace.Span.Kind |
getKind()
Returns the kind of this
Span. |
long |
getLatencyNs()
Returns the latency of the
Span in nanos. |
String |
getName()
Returns the name of the
Span. |
RecordEventsSpanImpl |
getNext()
Returns a reference to the next element in the list.
|
RecordEventsSpanImpl |
getPrev()
Returns a reference to the previous element in the list.
|
boolean |
getSampleToLocalSpanStore()
Returns if the name of this
Span must be register to the SampledSpanStore. |
io.opencensus.trace.Status |
getStatus()
Returns the status of the
Span. |
void |
putAttribute(String key,
io.opencensus.trace.AttributeValue value) |
void |
putAttributes(Map<String,io.opencensus.trace.AttributeValue> attributes) |
void |
setNext(RecordEventsSpanImpl element)
Sets the reference to the next element in the list.
|
void |
setPrev(RecordEventsSpanImpl element)
Sets the reference to the previous element in the list.
|
void |
setStatus(io.opencensus.trace.Status status) |
static RecordEventsSpanImpl |
startSpan(io.opencensus.trace.SpanContext context,
String name,
io.opencensus.trace.Span.Kind kind,
io.opencensus.trace.SpanId parentSpanId,
Boolean hasRemoteParent,
io.opencensus.trace.config.TraceParams traceParams,
RecordEventsSpanImpl.StartEndHandler startEndHandler,
TimestampConverter timestampConverter,
io.opencensus.common.Clock clock)
Creates and starts a span with the given configuration.
|
io.opencensus.trace.export.SpanData |
toSpanData()
Returns an immutable representation of all the data from this
Span. |
public static RecordEventsSpanImpl startSpan(io.opencensus.trace.SpanContext context, String name, @Nullable io.opencensus.trace.Span.Kind kind, @Nullable io.opencensus.trace.SpanId parentSpanId, @Nullable Boolean hasRemoteParent, io.opencensus.trace.config.TraceParams traceParams, RecordEventsSpanImpl.StartEndHandler startEndHandler, @Nullable TimestampConverter timestampConverter, io.opencensus.common.Clock clock)
context - supplies the trace_id and span_id for the newly started span.name - the displayed name for the new span.parentSpanId - the span_id of the parent span, or null if the new span is a root span.hasRemoteParent - true if the parentContext is remote. null if this is a
root span.traceParams - trace parameters like sampler and probability.startEndHandler - handler called when the span starts and ends.timestampConverter - null if the span is a root span or the parent is not sampled. If the
parent is sampled, we should use the same converter to ensure ordering between tracing
events.clock - the clock used to get the time.public String getName()
Span.Span.public io.opencensus.trace.Status getStatus()
Span. If not set defaults to Status.OK.Span.public long getEndNanoTime()
System.nanoTime()). If the current Span is not
ended then returns Clock.nowNanos().public long getLatencyNs()
Span in nanos. If still active then returns now() - start
time.Span in nanos.public boolean getSampleToLocalSpanStore()
Span must be register to the SampledSpanStore.Span must be register to the SampledSpanStore.@Nullable public io.opencensus.trace.Span.Kind getKind()
Span.Span.public io.opencensus.trace.export.SpanData toSpanData()
Span.Span.IllegalStateException - if the Span doesn't have RECORD_EVENTS option.public void putAttribute(String key, io.opencensus.trace.AttributeValue value)
putAttribute in class io.opencensus.trace.Spanpublic void putAttributes(Map<String,io.opencensus.trace.AttributeValue> attributes)
putAttributes in class io.opencensus.trace.Spanpublic void addAnnotation(String description, Map<String,io.opencensus.trace.AttributeValue> attributes)
addAnnotation in class io.opencensus.trace.Spanpublic void addAnnotation(io.opencensus.trace.Annotation annotation)
addAnnotation in class io.opencensus.trace.Spanpublic void addMessageEvent(io.opencensus.trace.MessageEvent messageEvent)
addMessageEvent in class io.opencensus.trace.Spanpublic void addLink(io.opencensus.trace.Link link)
addLink in class io.opencensus.trace.Spanpublic void setStatus(io.opencensus.trace.Status status)
setStatus in class io.opencensus.trace.Spanpublic void end(io.opencensus.trace.EndSpanOptions options)
end in class io.opencensus.trace.Span@Nullable public RecordEventsSpanImpl getNext()
ConcurrentIntrusiveList.ElementgetNext in interface ConcurrentIntrusiveList.Element<RecordEventsSpanImpl>public void setNext(@Nullable RecordEventsSpanImpl element)
ConcurrentIntrusiveList.ElementsetNext in interface ConcurrentIntrusiveList.Element<RecordEventsSpanImpl>element - the reference to the next element in the list.@Nullable public RecordEventsSpanImpl getPrev()
ConcurrentIntrusiveList.ElementgetPrev in interface ConcurrentIntrusiveList.Element<RecordEventsSpanImpl>public void setPrev(@Nullable RecordEventsSpanImpl element)
ConcurrentIntrusiveList.ElementsetPrev in interface ConcurrentIntrusiveList.Element<RecordEventsSpanImpl>element - the reference to the previous element in the list.