OpenTelemetry.Api
Extension methods on ActivityContext.
Returns a bool indicating if a ActivityContext is valid or not.
ActivityContext.
whether the context is a valid one or not.
Baggage implementation.
Spec reference: Baggage API.
Initializes a new instance of the struct.
Baggage key/value pairs.
Gets or sets the current .
Note: returns a forked version of the current
Baggage. Changes to the forked version will not automatically be
reflected back on . To update either use one of the static methods that target
as the default source or set to a new instance of .
Examples:
Baggage.SetBaggage("newKey1", "newValue1"); // Updates Baggage.Current with 'newKey1'
Baggage.SetBaggage("newKey2", "newValue2"); // Updates Baggage.Current with 'newKey2'
Or:
var baggageCopy = Baggage.Current;
Baggage.SetBaggage("newKey1", "newValue1"); // Updates Baggage.Current with 'newKey1'
var newBaggage = baggageCopy
.SetBaggage("newKey2", "newValue2");
.SetBaggage("newKey3", "newValue3");
// Sets Baggage.Current to 'newBaggage' which will override any
// changes made to Baggage.Current after the copy was made. For example
// the 'newKey1' change is lost.
Baggage.Current = newBaggage;
Gets the number of key/value pairs in the baggage.
Compare two entries of for equality.
First Entry to compare.
Second Entry to compare.
Compare two entries of for not equality.
First Entry to compare.
Second Entry to compare.
Create a instance from dictionary of baggage key/value pairs.
Baggage key/value pairs.
.
Returns the name/value pairs in the .
Optional . is used if not specified.
Baggage key/value pairs.
Returns an enumerator that iterates through the .
Optional . is used if not specified.
.
Returns the value associated with the given name, or if the given name is not present.
Baggage item name.
Optional . is used if not specified.
Baggage item or if nothing was found.
Returns a new which contains the new key/value pair.
Baggage item name.
Baggage item value.
Optional . is used if not specified.
New containing the key/value pair.
Note: The returned will be set as the new instance.
Returns a new which contains the new key/value pairs.
Baggage key/value pairs.
Optional . is used if not specified.
New containing the new key/value pairs.
Note: The returned will be set as the new instance.
Returns a new with the key/value pair removed.
Baggage item name.
Optional . is used if not specified.
New with the key/value pair removed.
Note: The returned will be set as the new instance.
Returns a new with all the key/value pairs removed.
Optional . is used if not specified.
New with all the key/value pairs removed.
Note: The returned will be set as the new instance.
Returns the name/value pairs in the .
Baggage key/value pairs.
Returns the value associated with the given name, or if the given name is not present.
Baggage item name.
Baggage item or if nothing was found.
Returns a new which contains the new key/value pair.
Baggage item name.
Baggage item value.
New containing the key/value pair.
Returns a new which contains the new key/value pairs.
Baggage key/value pairs.
New containing the key/value pairs.
Returns a new which contains the new key/value pairs.
Baggage key/value pairs.
New containing the key/value pairs.
Returns a new with the key/value pair removed.
Baggage item name.
New with the key/value pair removed.
Returns a new with all the key/value pairs removed.
New with all the key/value pairs removed.
Returns an enumerator that iterates through the .
.
Contains logic shared by all OpenTelemetry providers.
Finalizes an instance of the class.
Releases the unmanaged resources used by this class and optionally releases the managed resources.
to release both managed and unmanaged resources; to release only unmanaged resources.
The async local implementation of context slot.
The type of the underlying value.
Initializes a new instance of the class.
The name of the context slot.
Describes a type of which can expose its value as an .
Gets or sets the value of the slot as an .
A text map propagator for B3. See https://github.com/openzipkin/b3-propagation.
This class has been deprecated in favour of OpenTelemetry.Extensions.Propagators package.
Initializes a new instance of the class.
Initializes a new instance of the class.
Determines whether to use single or multiple headers when extracting or injecting span context.
A text map propagator for W3C Baggage. See https://w3c.github.io/baggage/.
CompositeTextMapPropagator provides a mechanism for combining multiple
textmap propagators into a single one.
Initializes a new instance of the class.
List of wire context propagator.
Stores propagation data.
Initializes a new instance of the struct.
.
.
Gets .
Gets .
Compare two entries of for equality.
First Entry to compare.
Second Entry to compare.
Compare two entries of for not equality.
First Entry to compare.
Second Entry to compare.
Propagators allow setting the global default Propagators.
Gets the Default TextMapPropagator to be used.
Setting this can be done only from Sdk.
Defines an interface for a Propagator of TextMap type,
which uses string key/value pairs to inject and extract
propagation data.
Gets the list of headers used by propagator. The use cases of this are:
* allow pre-allocation of fields, especially in systems like gRPC Metadata
* allow a single-pass over an iterator (ex OpenTracing has no getter in TextMap).
Injects the context into a carrier.
Type of object to set context on. Typically,HttpRequest or similar.
The default context to transmit over the wire.
Object to set context on. Instance of this object will be passed to setter.
Action that will set name and value pair on the object.
Extracts the context from a carrier.
Type of object to extract context from. Typically, HttpRequest or similar.
The default context to be used if Extract fails.
Object to extract context from. Instance of this object will be passed to the getter.
Function that will return string value of a key with the specified name.
Context from its text representation.
A text map propagator for W3C trace context. See https://w3c.github.io/trace-context/.
Extension methods to extract TraceState from string.
Extracts tracestate pairs from the given string and appends it to provided tracestate list.
String with comma separated tracestate key value pairs.
to set tracestate pairs on.
True if string was parsed successfully and tracestate was recognized, false otherwise.
Generic runtime context management API.
Gets or sets the actual context carrier implementation.
Register a named context slot.
The name of the context slot.
The type of the underlying value.
The slot registered.
Get a registered slot from a given name.
The name of the context slot.
The type of the underlying value.
The slot previously registered.
Sets the value to a registered slot.
The name of the context slot.
The value to be set.
The type of the value.
Gets the value from a registered slot.
The name of the context slot.
The type of the value.
The value retrieved from the context slot.
Sets the value to a registered slot.
The name of the context slot.
The value to be set.
Gets the value from a registered slot.
The name of the context slot.
The value retrieved from the context slot.
The abstract context slot.
The type of the underlying value.
Initializes a new instance of the class.
The name of the context slot.
Gets the name of the context slot.
Get the value from the context slot.
The value retrieved from the context slot.
Set the value to the context slot.
The value to be set.
Releases the unmanaged resources used by this class and optionally releases the managed resources.
to release both managed and unmanaged resources; to release only unmanaged resources.
The thread local (TLS) implementation of context slot.
The type of the underlying value.
Initializes a new instance of the class.
The name of the context slot.
EventSource implementation for OpenTelemetry API.
This is used for internal logging of this library.
Returns a culture-independent string representation of the given object,
appropriate for diagnostics tracing.
Exception to convert to string.
Exception as string with no culture.
Methods for guarding against exception throwing values.
Throw an exception if the value is null.
The value to check.
The parameter name to use in the thrown exception.
Throw an exception if the value is null or empty.
The value to check.
The parameter name to use in the thrown exception.
Throw an exception if the value is null or whitespace.
The value to check.
The parameter name to use in the thrown exception.
Throw an exception if the value is zero.
The value to check.
The message to use in the thrown exception.
The parameter name to use in the thrown exception.
Throw an exception if the value is not considered a valid timeout.
The value to check.
The parameter name to use in the thrown exception.
Throw an exception if the value is not within the given range.
The value to check.
The parameter name to use in the thrown exception.
The inclusive lower bound.
The inclusive upper bound.
The name of the lower bound.
The name of the upper bound.
An optional custom message to use in the thrown exception.
Throw an exception if the value is not within the given range.
The value to check.
The parameter name to use in the thrown exception.
The inclusive lower bound.
The inclusive upper bound.
The name of the lower bound.
The name of the upper bound.
An optional custom message to use in the thrown exception.
Throw an exception if the value is not of the expected type.
The value to check.
The parameter name to use in the thrown exception.
The type attempted to convert to.
The value casted to the specified type.
Describes a logger provider builder that supports deferred
initialization using an to perform
dependency injection.
Register a callback action to configure the once the application is available.
Configuration callback.
The supplied for chaining.
Logger is the class responsible for creating log records.
Initializes a new instance of the class.
Optional name identifying the instrumentation library.
Gets the name identifying the instrumentation library.
Gets the version of the instrumentation library.
Emit a log.
.
Emit a log.
.
.
LoggerProvider is the entry point of the OpenTelemetry API. It provides access to .
Initializes a new instance of the class.
LoggerProviderBuilder base class.
Initializes a new instance of the class.
Adds instrumentation to the provider.
Type of instrumentation class.
Function that builds instrumentation.
Returns for chaining.
Stores attributes to be added to a log message.
Add an attribute.
Attribute name.
Attribute value.
Create a collection from an enumerable.
Source attributes.
.
Add an attribute.
Attribute name.
Attribute value.
Add an attribute.
Attribute.
Removes all elements from the .
Adds attributes representing an to the list.
.
Returns an enumerator that iterates through the .
.
Enumerates the elements of a .
Stores details about a log message.
Initializes a new instance of the struct.
Notes:
- The property is initialized to automatically.
- The , , and properties will be set using the instance.
Initializes a new instance of the struct.
Note: The property is initialized to automatically.
Optional used to populate
trace context properties (, ,
and ).
Initializes a new instance of the struct.
Note: The property is initialized to automatically.
used to
populate trace context properties (, , and ).
Gets or sets the log timestamp.
Note: If is set to a value with it will be automatically converted to
UTC using .
Gets or sets the log .
Gets or sets the log .
Gets or sets the log .
Gets or sets the original string representation of the severity as it is
known at the source.
Gets or sets the log severity.
Gets or sets the log body.
Describes the severity level of a log record.
Unspecified severity (0).
Trace severity (1).
Trace1 severity (2).
Trace3 severity (3).
Trace4 severity (4).
Debug severity (5).
Debug2 severity (6).
Debug3 severity (7).
Debug4 severity (8).
Info severity (9).
Info2 severity (11).
Info3 severity (12).
Info4 severity (13).
Warn severity (13).
Warn2 severity (14).
Warn3 severity (15).
Warn severity (16).
Error severity (17).
Error2 severity (18).
Error3 severity (19).
Error4 severity (20).
Fatal severity (21).
Fatal2 severity (22).
Fatal3 severity (23).
Fatal4 severity (24).
Contains extension methods for the enum.
Returns the OpenTelemetry Specification short name for the suitable for display.
See: .
.
OpenTelemetry Specification short name for the supplied .
Describes a meter provider builder that supports deferred initialization
using an to perform dependency injection.
Register a callback action to configure the once the application is available.
Configuration callback.
The supplied for chaining.
MeterProvider base class.
Initializes a new instance of the class.
MeterProviderBuilder base class.
Initializes a new instance of the class.
Adds instrumentation to the provider.
Type of instrumentation class.
Function that builds instrumentation.
Returns for chaining.
Adds given Meter names to the list of subscribed meters.
Meter names.
Returns for chaining.
Extension methods on Activity.
Sets the status of activity execution.
Note: This method is obsolete. Call the
method instead. For more details see: .
Activity instance.
Activity execution status.
Gets the status of activity execution.
Note: This method is obsolete. Use the and
properties instead. For more
details see: .
Activity instance.
Activity execution status.
Adds an containing information from the specified exception.
Activity instance.
Exception to be recorded.
Note: This method is obsolete. Please use instead.
The exception is recorded as per specification.
"exception.stacktrace" is represented using the value of Exception.ToString.
Adds an containing information from the specified exception and additional tags.
Activity instance.
Exception to be recorded.
Additional tags to record on the event.
Note: This method is obsolete. Please use instead.
The exception is recorded as per specification.
"exception.stacktrace" is represented using the value of Exception.ToString.
Describes a tracer provider builder that supports deferred
initialization using an to perform
dependency injection.
Register a callback action to configure the once the application is available.
Configuration callback.
The supplied for chaining.
Link associated with the span.
Initializes a new instance of the struct.
Span context of a linked span.
Initializes a new instance of the struct.
Span context of a linked span.
Link attributes.
Gets the span context of a linked span.
Gets the collection of attributes associated with the link.
Compare two for equality.
First link to compare.
Second link to compare.
Compare two for not equality.
First link to compare.
Second link to compare.
A class that represents the span attributes. Read more here https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute.
SpanAttributes is a wrapper around class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Initial attributes to store in the collection.
Add entry to the attributes.
Entry key.
Entry value.
Add entry to the attributes.
Entry key.
Entry value.
Add entry to the attributes.
Entry key.
Entry value.
Add entry to the attributes.
Entry key.
Entry value.
Add entry to the attributes.
Entry key.
Entry value.
Add entry to the attributes.
Entry key.
Entry value.
Add entry to the attributes.
Entry key.
Entry value.
Add entry to the attributes.
Entry key.
Entry value.
A struct that represents a span context. A span context contains the portion of a span
that must propagate to child and across process boundaries.
It contains the identifiers and
associated with the along with a set of
common and system-specific values>.
SpanContext is a wrapper around .
Initializes a new instance of the struct with the given identifiers and options.
The to associate with the .
The to associate with the .
The to
associate with the .
The value indicating whether this was propagated from the remote parent.
The traceState to associate with the .
Initializes a new instance of the struct with the given identifiers and options.
The activity context.
Gets the associated with this .
Gets the associated with this .
Gets the associated with this .
Gets a value indicating whether this
was propagated from a remote parent.
Gets a value indicating whether this is valid.
Gets the associated with this .
Converts a into an .
source.
Compare two for equality.
First SpanContext to compare.
Second SpanContext to compare.
Compare two for not equality.
First SpanContext to compare.
Second SpanContext to compare.
Span kind.
Span kind was not specified.
Server span represents request incoming from external component.
Client span represents outgoing request to the external component.
Producer span represents output provided to external components. Unlike client and
server, there is no direct critical path latency relationship between producer and consumer
spans.
Consumer span represents output received from an external component. Unlike client and
server, there is no direct critical path latency relationship between producer and consumer
spans.
Span execution status.
The operation completed successfully.
The default status.
The operation contains an error.
Gets the canonical code from this status.
Gets the status description.
Compare two for equality.
First Status to compare.
Second Status to compare.
Compare two for not equality.
First Status to compare.
Second Status to compare.
Returns a new instance of a status with the description populated.
Note: Status Description is only valid for Status and will be ignored for all other
values. See the Status
API for details.
Description of the status.
New instance of the status class with the description populated.
Canonical result code of span execution.
The default status.
The operation completed successfully.
The operation contains an error.
Span represents a single operation within a trace.
TelemetrySpan is a wrapper around class.
Gets the span context.
Gets a value indicating whether this span will be recorded.
Gets the identity of the parent span id, if any.
Sets the status of the span execution.
Status to be set.
Updates the name.
If used, this will override the name provided via StartSpan method overload.
Upon this update, any sampling behavior based on name will depend on the
implementation.
Name of the span.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute value.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute value.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute value.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute value.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute values.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute values.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute values.
The instance for chaining.
Sets a new attribute on the span.
Attribute key.
Attribute values.
The instance for chaining.
Adds a single Event to the .
Name of the event.
The instance for chaining.
Adds a single Event to the .
Name of the event.
Timestamp of the event.
The instance for chaining.
Adds a single Event to the .
Name of the event.
Attributes for the event.
The instance for chaining.
Adds a single Event to the .
Name of the event.
Timestamp of the event.
Attributes for the event.
The instance for chaining.
End the span.
End the span.
End timestamp.
Record Exception.
Exception to be recorded.
The instance for chaining.
Record Exception.
Type of the exception to be recorded.
Message of the exception to be recorded.
Stacktrace of the exception to be recorded.
The instance for chaining.
Marks the span as current.
Releases the unmanaged resources used by this class and optionally releases the managed resources.
to release both managed and unmanaged resources; to release only unmanaged resources.
Tracer is the class responsible for creating .
Tracer is a wrapper around class.
Gets the current span from the context.
Sets the given span as the current one in the context.
The span to be made current.
The supplied span for call chaining.
Starts root span.
Span name.
Kind.
Initial attributes for the span.
for the span.
Start time for the span.
Span instance.
Starts a span and does not make it as current span.
Span name.
Kind.
Parent for new span.
Initial attributes for the span.
for the span.
Start time for the span.
Span instance.
Starts a span and does not make it as current span.
Span name.
Kind.
Parent Context for new span.
Initial attributes for the span.
for the span.
Start time for the span.
Span instance.
Starts a span and make it the current active span.
Span name.
Kind.
Parent for new span.
Initial attributes for the span.
for the span.
Start time for the span.
Span instance.
Starts a span and make it the current active span.
Span name.
Kind.
Parent Context for new span.
Initial attributes for the span.
for the span.
Start time for the span.
Span instance.
TracerProvider is the entry point of the OpenTelemetry API. It provides access to .
Initializes a new instance of the class.
Gets the default .
Gets a tracer with given name and version.
Name identifying the instrumentation library.
Version of the instrumentation library.
Tracer instance.
Gets a tracer with given name, version and tags.
Name identifying the instrumentation library.
Version of the instrumentation library.
Tags associated with the tracer.
Tracer instance.
TracerProviderBuilder base class.
Initializes a new instance of the class.
Adds instrumentation to the provider.
Type of instrumentation class.
Function that builds instrumentation.
Returns for chaining.
Adds the given names to the list of subscribed sources.
Activity source names.
Returns for chaining.
Adds a listener for objects created with the given operation name to the .
This is provided to capture legacy objects created without using the API.
Operation name of the objects to capture.
Returns for chaining.
Extension methods on Activity.
Gets the status of activity execution.
Activity class in .NET does not support 'Status'.
This extension provides a workaround to retrieve Status from special tags with key name otel.status_code and otel.status_description.
Activity instance.
.
Status description.
if was found on the supplied Activity.
Gets the value of a specific tag on an .
Activity instance.
Case-sensitive tag name to retrieve.
Tag value or null if a match was not found.
Checks if the user provided tag name is the first tag of the and retrieves the tag value.
Activity instance.
Tag name.
Tag value.
if the first tag of the supplied Activity matches the user provide tag name.
Constants for semantic attribute names outlined by the OpenTelemetry specifications.
Defines well-known span attribute keys.
Allows capturing of the expressions passed to a method.
Specifies that an output is not even if
the corresponding type allows it. Specifies that an input argument was
not when the call returns.