Freigeben über


OpenTelemetryScope Class

Definition

Base class for OpenTelemetry tracing scopes in the AI SDK, providing common telemetry functionality.

public abstract class OpenTelemetryScope : IDisposable
type OpenTelemetryScope = class
    interface IDisposable
Public MustInherit Class OpenTelemetryScope
Implements IDisposable
Inheritance
OpenTelemetryScope
Derived
Implements

Constructors

Name Description
OpenTelemetryScope(ActivityKind, AgentDetails, TenantDetails, String, String, Nullable<DateTimeOffset>, String)

Initializes a new instance of the OpenTelemetryScope class.

Properties

Name Description
Id

Gets the span ID for the current activity.

TraceId

Gets the trace ID for the current activity.

Methods

Name Description
AddBaggage(String, String)

Adds baggage to the current activity for distributed tracing context propagation.

Dispose()

Disposes the scope and finalizes telemetry data collection.

RecordAttributes(IEnumerable<KeyValuePair<String,Object>>)

Records multiple attribute key/value pairs for telemetry tracking.

RecordCancellation()

Record the task cancellation event.

RecordError(Exception)

Log the error.

SetEndTime(DateTimeOffset)

Sets a custom end time for the scope. This allows for manual control of the scope duration.

SetStartTime(DateTimeOffset)

Sets a custom start time for the scope. This allows for manual control of the scope start time. Can be used in addition to or instead of setting start time via constructor.

SetTagMaybe(String, Object)

Set the tag on the activity if the tag is present.

Applies to