Class TestSpanData.Builder
java.lang.Object
io.opentelemetry.sdk.testing.trace.TestSpanData.Builder
- Enclosing class:
- TestSpanData
A
Builder
class for TestSpanData
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create a new SpanData instance from the data in this.abstract TestSpanData.Builder
setAttributes
(io.opentelemetry.api.common.Attributes attributes) Set the attributes that are associated with this span, in the form ofAttributes
.abstract TestSpanData.Builder
setEndEpochNanos
(long epochNanos) Set the end timestamp of the span.abstract TestSpanData.Builder
Set timed events that are associated with this span.final TestSpanData.Builder
setHasEnded
(boolean hasEnded) Sets to true if the span has been ended.abstract TestSpanData.Builder
setInstrumentationLibraryInfo
(io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo) Sets the instrumentation library of the tracer which created this span.abstract TestSpanData.Builder
setKind
(io.opentelemetry.api.trace.SpanKind kind) Set the kind of span.abstract TestSpanData.Builder
Set the links associated with this span.abstract TestSpanData.Builder
Set the name of the span.abstract TestSpanData.Builder
setParentSpanContext
(io.opentelemetry.api.trace.SpanContext parentSpanContext) The parent span context associated for this span, which may be null.abstract TestSpanData.Builder
setResource
(io.opentelemetry.sdk.resources.Resource resource) Set theResource
associated with this span.abstract TestSpanData.Builder
setSpanContext
(io.opentelemetry.api.trace.SpanContext spanContext) Set theSpanContext
on this builder.abstract TestSpanData.Builder
setStartEpochNanos
(long epochNanos) Set the start timestamp of the span.abstract TestSpanData.Builder
setStatus
(io.opentelemetry.sdk.trace.data.StatusData status) Set the status for this span.abstract TestSpanData.Builder
setTotalAttributeCount
(int totalAttributeCount) Set the total number of attributes recorded on this span.abstract TestSpanData.Builder
setTotalRecordedEvents
(int totalRecordedEvents) Set the total number of events recorded on this span.abstract TestSpanData.Builder
setTotalRecordedLinks
(int totalRecordedLinks) Set the total number of links recorded on this span.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Create a new SpanData instance from the data in this.- Returns:
- a new SpanData instance
-
setSpanContext
public abstract TestSpanData.Builder setSpanContext(io.opentelemetry.api.trace.SpanContext spanContext) Set theSpanContext
on this builder.- Parameters:
spanContext
- theSpanContext
.- Returns:
- this builder (for chaining).
-
setParentSpanContext
public abstract TestSpanData.Builder setParentSpanContext(io.opentelemetry.api.trace.SpanContext parentSpanContext) The parent span context associated for this span, which may be null.- Parameters:
parentSpanContext
- the SpanId of the parent- Returns:
- this.
-
setResource
Set theResource
associated with this span. Must not be null.- Parameters:
resource
- the Resource that generated this span.- Returns:
- this
-
setInstrumentationLibraryInfo
public abstract TestSpanData.Builder setInstrumentationLibraryInfo(io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo) Sets the instrumentation library of the tracer which created this span. Must not be null.- Parameters:
instrumentationLibraryInfo
- the instrumentation library of the tracer which created this span.- Returns:
- this
-
setName
Set the name of the span. Must not be null.- Parameters:
name
- the name.- Returns:
- this
-
setStartEpochNanos
Set the start timestamp of the span.- Parameters:
epochNanos
- the start epoch timestamp in nanos.- Returns:
- this
-
setEndEpochNanos
Set the end timestamp of the span.- Parameters:
epochNanos
- the end epoch timestamp in nanos.- Returns:
- this
-
setAttributes
public abstract TestSpanData.Builder setAttributes(io.opentelemetry.api.common.Attributes attributes) Set the attributes that are associated with this span, in the form ofAttributes
.- Parameters:
attributes
-Attributes
for this span.- Returns:
- this
- See Also:
-
Attributes
-
setEvents
public abstract TestSpanData.Builder setEvents(List<io.opentelemetry.sdk.trace.data.EventData> events) Set timed events that are associated with this span. Must not be null, may be empty.- Parameters:
events
- A List<Event> of events associated with this span.- Returns:
- this
- See Also:
-
EventData
-
setStatus
Set the status for this span. Must not be null.- Parameters:
status
- The Status of this span.- Returns:
- this
-
setKind
Set the kind of span. Must not be null.- Parameters:
kind
- The Kind of span.- Returns:
- this
-
setLinks
Set the links associated with this span. Must not be null, may be empty.- Parameters:
links
- A List<Link>- Returns:
- this
-
setHasEnded
Sets to true if the span has been ended.- Parameters:
hasEnded
- A boolean indicating if the span has been ended.- Returns:
- this
-
setTotalRecordedEvents
Set the total number of events recorded on this span.- Parameters:
totalRecordedEvents
- The total number of events recorded.- Returns:
- this
-
setTotalRecordedLinks
Set the total number of links recorded on this span.- Parameters:
totalRecordedLinks
- The total number of links recorded.- Returns:
- this
-
setTotalAttributeCount
Set the total number of attributes recorded on this span.- Parameters:
totalAttributeCount
- The total number of attributes recorded.- Returns:
- this
-