Class Tracer
- Namespace
- OpenTelemetry.Trace
- Assembly
- OpenTelemetry.Api.dll
Tracer is the class responsible for creating TelemetrySpan.
public class Tracer
- Inheritance
-
Tracer
- Inherited Members
Remarks
Tracer is a wrapper around OpenTelemetry.Trace.Tracer.ActivitySource class.
Properties
CurrentSpan
Gets the current span from the context.
public static TelemetrySpan CurrentSpan { get; }
Property Value
Methods
StartActiveSpan(string, SpanKind, in SpanContext, SpanAttributes, IEnumerable<Link>, DateTimeOffset)
Starts a span and make it the current active span.
public TelemetrySpan StartActiveSpan(string name, SpanKind kind = SpanKind.Internal, in SpanContext parentContext = default, SpanAttributes initialAttributes = null, IEnumerable<Link> links = null, DateTimeOffset startTime = default)
Parameters
name
stringSpan name.
kind
SpanKindKind.
parentContext
SpanContextParent Context for new span.
initialAttributes
SpanAttributesInitial attributes for the span.
links
IEnumerable<Link>Link for the span.
startTime
DateTimeOffsetStart time for the span.
Returns
- TelemetrySpan
Span instance.
StartActiveSpan(string, SpanKind, in TelemetrySpan, SpanAttributes, IEnumerable<Link>, DateTimeOffset)
Starts a span and make it the current active span.
public TelemetrySpan StartActiveSpan(string name, SpanKind kind, in TelemetrySpan parentSpan, SpanAttributes initialAttributes = null, IEnumerable<Link> links = null, DateTimeOffset startTime = default)
Parameters
name
stringSpan name.
kind
SpanKindKind.
parentSpan
TelemetrySpanParent for new span.
initialAttributes
SpanAttributesInitial attributes for the span.
links
IEnumerable<Link>Link for the span.
startTime
DateTimeOffsetStart time for the span.
Returns
- TelemetrySpan
Span instance.
StartRootSpan(string, SpanKind, SpanAttributes, IEnumerable<Link>, DateTimeOffset)
Starts root span.
public TelemetrySpan StartRootSpan(string name, SpanKind kind = SpanKind.Internal, SpanAttributes initialAttributes = null, IEnumerable<Link> links = null, DateTimeOffset startTime = default)
Parameters
name
stringSpan name.
kind
SpanKindKind.
initialAttributes
SpanAttributesInitial attributes for the span.
links
IEnumerable<Link>Link for the span.
startTime
DateTimeOffsetStart time for the span.
Returns
- TelemetrySpan
Span instance.
StartSpan(string, SpanKind, in SpanContext, SpanAttributes, IEnumerable<Link>, DateTimeOffset)
Starts a span and does not make it as current span.
public TelemetrySpan StartSpan(string name, SpanKind kind = SpanKind.Internal, in SpanContext parentContext = default, SpanAttributes initialAttributes = null, IEnumerable<Link> links = null, DateTimeOffset startTime = default)
Parameters
name
stringSpan name.
kind
SpanKindKind.
parentContext
SpanContextParent Context for new span.
initialAttributes
SpanAttributesInitial attributes for the span.
links
IEnumerable<Link>Link for the span.
startTime
DateTimeOffsetStart time for the span.
Returns
- TelemetrySpan
Span instance.
StartSpan(string, SpanKind, in TelemetrySpan, SpanAttributes, IEnumerable<Link>, DateTimeOffset)
Starts a span and does not make it as current span.
public TelemetrySpan StartSpan(string name, SpanKind kind, in TelemetrySpan parentSpan, SpanAttributes initialAttributes = null, IEnumerable<Link> links = null, DateTimeOffset startTime = default)
Parameters
name
stringSpan name.
kind
SpanKindKind.
parentSpan
TelemetrySpanParent for new span.
initialAttributes
SpanAttributesInitial attributes for the span.
links
IEnumerable<Link>Link for the span.
startTime
DateTimeOffsetStart time for the span.
Returns
- TelemetrySpan
Span instance.
WithSpan(TelemetrySpan)
Makes the given span as the current one.
public static TelemetrySpan WithSpan(TelemetrySpan span)
Parameters
span
TelemetrySpanThe span to be made current.
Returns
- TelemetrySpan
The current span.