Language

ApplyGuardrailScope Class

Definition

Provides OpenTelemetry tracing scope for security guardrail evaluation operations.

public sealed class ApplyGuardrailScope : Microsoft.Agents.A365.Observability.Runtime.Tracing.Scopes.OpenTelemetryScope
type ApplyGuardrailScope = class
    inherit OpenTelemetryScope
Public NotInheritable Class ApplyGuardrailScope
Inherits OpenTelemetryScope
Inheritance
ApplyGuardrailScope

Remarks

Describes a security guardian evaluation. Multiple guardian spans MAY exist under a single operation span if multiple guardians are chained.

Guardian spans SHOULD be children of the operation span they are protecting (e.g., inference or execute_tool spans).

Properties

Name Description
Id

Gets the span ID for the current activity.

(Inherited from OpenTelemetryScope)
TraceId

Gets the trace ID for the current activity.

(Inherited from OpenTelemetryScope)

Methods

Name Description
AddBaggage(String, String)

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

(Inherited from OpenTelemetryScope)
AddEvent(ActivityEvent)

Adds an event to the current activity.

(Inherited from OpenTelemetryScope)
Dispose()

Disposes the scope and finalizes telemetry data collection.

(Inherited from OpenTelemetryScope)
GetActivityContext()

Gets the ActivityContext for this scope's span.

(Inherited from OpenTelemetryScope)
InjectTraceContext()

Injects this span's trace context into W3C HTTP headers.

(Inherited from OpenTelemetryScope)
RecordAttributes(IEnumerable<KeyValuePair<String,Object>>)

Records multiple attribute key/value pairs for telemetry tracking.

(Inherited from OpenTelemetryScope)
RecordCancellation()

Record the task cancellation event.

(Inherited from OpenTelemetryScope)
RecordContentOutput(String)

Records the output content value for the guardrail evaluation (opt-in).

RecordDecision(GuardrailDecisionType, String)

Records an updated decision on the guardrail span. Use this when the guardrail decision is determined after span creation.

RecordError(Exception)

Log the error.

(Inherited from OpenTelemetryScope)
RecordFinding(GuardrailFinding)

Records a security finding event on the current span. Multiple findings may be recorded per guardrail evaluation.

SetEndTime(DateTimeOffset)

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

(Inherited from OpenTelemetryScope)
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.

(Inherited from OpenTelemetryScope)
SetTagMaybe(String, Object)

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

(Inherited from OpenTelemetryScope)
Start(GuardrailDetails, AgentDetails, Request, UserDetails, SpanDetails)

Creates and starts a new scope for guardrail evaluation tracing.

Applies to