OutputScope class
親スパン リンクを使用した出力メッセージ トレースの OpenTelemetry トレース スコープを提供します。
- Extends
メソッド
| record |
テレメトリ追跡用の出力メッセージを記録します。 スパンで以前に記録された出力メッセージをすべて上書きします。 1 つの文字列、文字列の配列 (OTEL OutputMessage として自動ラップ)、バージョン管理された OutputMessages ラッパー、または生のディクテーション (OTEL 仕様ごとにツール呼び出し結果として扱われ、直接シリアル化) を受け入れます。 |
| start(Request, Output |
出力メッセージ トレースの新しいスコープを作成して開始します。 |
継承されたメソッド
| dispose() | 互換性のための従来の dispose メソッド |
| get |
このスコープのスパン コンテキストを取得します。 これを使用して、非同期境界を越えた明示的な親子リンク用の ParentSpanRef を作成できます。 |
| record |
テレメトリ追跡用に複数の属性キーと値のペアを記録します。 |
| record |
スパンのキャンセル イベントを記録します。 取り消し理由でスパンの状態を ERROR に設定し、エラーの種類を "TaskCanceledException" としてマークします。 |
| record |
操作中に発生したエラーを記録します |
| set |
スコープのカスタム終了時刻を設定します。
設定すると、 dispose はこの値を現在の実時間ではなく |
| with |
非同期コールバックの実行期間中、このスパンをアクティブにします |
メソッドの詳細
recordOutputMessages(ResponseMessagesParam)
テレメトリ追跡用の出力メッセージを記録します。 スパンで以前に記録された出力メッセージをすべて上書きします。 1 つの文字列、文字列の配列 (OTEL OutputMessage として自動ラップ)、バージョン管理された OutputMessages ラッパー、または生のディクテーション (OTEL 仕様ごとにツール呼び出し結果として扱われ、直接シリアル化) を受け入れます。
function recordOutputMessages(messages: ResponseMessagesParam)
パラメーター
- messages
- ResponseMessagesParam
文字列、文字列の配列、OutputMessages ラッパー、または dict。
start(Request, OutputResponse, AgentDetails, UserDetails, SpanDetails)
出力メッセージ トレースの新しいスコープを作成して開始します。
static function start(request: Request, response: OutputResponse, agentDetails: AgentDetails, userDetails?: UserDetails, spanDetails?: SpanDetails): OutputScope
パラメーター
- request
- Request
要求ペイロード (チャネル、conversationId、コンテンツ、sessionId)。
- response
- OutputResponse
初期出力メッセージを含む応答。
- agentDetails
- AgentDetails
出力を生成するエージェント。 テナント ID は、 agentDetails.tenantIdから派生します。
- userDetails
- UserDetails
オプションの人間の呼び出し元 ID の詳細。
- spanDetails
- SpanDetails
オプションのスパン構成 (parentContext、startTime、endTime、spanLinks)。
返品
新しい OutputScope インスタンス。
継承済みメソッドの詳細
dispose()
getSpanContext()
このスコープのスパン コンテキストを取得します。 これを使用して、非同期境界を越えた明示的な親子リンク用の ParentSpanRef を作成できます。
function getSpanContext(): SpanContext
返品
SpanContext
traceId と spanId を含む SpanContext
Inherited FromOpenTelemetryScope.getSpanContext
recordAttributes(undefined | null | Iterable<[string, AttributeValue]> | Record<string, AttributeValue>)
テレメトリ追跡用に複数の属性キーと値のペアを記録します。
function recordAttributes(attributes: undefined | null | Iterable<[string, AttributeValue]> | Record<string, AttributeValue>)
パラメーター
- attributes
-
undefined | null | Iterable<[string, AttributeValue]> | Record<string, AttributeValue>
属性キーと値のペアのコレクション (配列または [キー、値] またはオブジェクト マップの iterable)。
Inherited FromOpenTelemetryScope.recordAttributes
recordCancellation(string)
スパンのキャンセル イベントを記録します。 取り消し理由でスパンの状態を ERROR に設定し、エラーの種類を "TaskCanceledException" としてマークします。
function recordCancellation(reason?: string)
パラメーター
- reason
-
string
省略可能な取り消し理由。 既定値は 'Task was cancelled' です。
Inherited FromOpenTelemetryScope.recordCancellation
recordError(Error)
操作中に発生したエラーを記録します
function recordError(error: Error)
パラメーター
- error
-
Error
発生したエラー
Inherited FromOpenTelemetryScope.recordError
setEndTime(TimeInput)
スコープのカスタム終了時刻を設定します。
設定すると、 dispose はこの値を現在の実時間ではなく span.end() に渡します。
これは、スコープが破棄される前に、操作の実際の終了時刻がわかっている場合に便利です。
function setEndTime(endTime: TimeInput)
パラメーター
- endTime
-
TimeInput
エポック、Date、または HrTime タプルからの終了時刻 (ミリ秒)。
Inherited FromOpenTelemetryScope.setEndTime
withActiveSpanAsync<T>(() => Promise<T>)
非同期コールバックの実行期間中、このスパンをアクティブにします
function withActiveSpanAsync<T>(callback: () => Promise<T>): Promise<T>
パラメーター
- callback
-
() => Promise<T>
返品
Promise<T>
OpenTelemetryScope.withActiveSpanAsyncから継承