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.BuildersetAttributes(io.opentelemetry.api.common.Attributes attributes) Set the attributes that are associated with this span, in the form ofAttributes.abstract TestSpanData.BuildersetEndEpochNanos(long epochNanos) Set the end timestamp of the span.abstract TestSpanData.BuilderSet timed events that are associated with this span.final TestSpanData.BuildersetHasEnded(boolean hasEnded) Sets to true if the span has been ended.setInstrumentationLibraryInfo(io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo) Deprecated.abstract TestSpanData.BuildersetInstrumentationScopeInfo(io.opentelemetry.sdk.common.InstrumentationScopeInfo instrumentationScopeInfo) Sets the instrumentation scope of the tracer which created this span.abstract TestSpanData.BuildersetKind(io.opentelemetry.api.trace.SpanKind kind) Set the kind of span.abstract TestSpanData.BuilderSet the links associated with this span.abstract TestSpanData.BuilderSet the name of the span.abstract TestSpanData.BuildersetParentSpanContext(io.opentelemetry.api.trace.SpanContext parentSpanContext) The parent span context associated for this span, which may be null.abstract TestSpanData.BuildersetResource(io.opentelemetry.sdk.resources.Resource resource) Set theResourceassociated with this span.abstract TestSpanData.BuildersetSpanContext(io.opentelemetry.api.trace.SpanContext spanContext) Set theSpanContexton this builder.abstract TestSpanData.BuildersetStartEpochNanos(long epochNanos) Set the start timestamp of the span.abstract TestSpanData.BuildersetStatus(io.opentelemetry.sdk.trace.data.StatusData status) Set the status for this span.abstract TestSpanData.BuildersetTotalAttributeCount(int totalAttributeCount) Set the total number of attributes recorded on this span.abstract TestSpanData.BuildersetTotalRecordedEvents(int totalRecordedEvents) Set the total number of events recorded on this span.abstract TestSpanData.BuildersetTotalRecordedLinks(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 theSpanContexton 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 theResourceassociated with this span. Must not be null.- Parameters:
resource- the Resource that generated this span.- Returns:
- this
-
setInstrumentationLibraryInfo
@Deprecated public TestSpanData.Builder setInstrumentationLibraryInfo(io.opentelemetry.sdk.common.InstrumentationLibraryInfo instrumentationLibraryInfo) Deprecated.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
-
setInstrumentationScopeInfo
public abstract TestSpanData.Builder setInstrumentationScopeInfo(io.opentelemetry.sdk.common.InstrumentationScopeInfo instrumentationScopeInfo) Sets the instrumentation scope of the tracer which created this span. Must not be null.- Parameters:
instrumentationScopeInfo- the instrumentation scope 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-Attributesfor 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
-
setInstrumentationScopeInfo(InstrumentationScopeInfo)instead.