> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # ArthurExporter OpenTelemetry と OpenInference セマンティック規約を使用して、Tracing データを [Arthur Engine](https://github.com/arthur-ai/arthur-engine) へ送信します。 ## コンストラクター ```typescript new ArthurExporter(config: ArthurExporterConfig) ``` ## `ArthurExporterConfig` ```typescript type ArthurExporterConfig = Omit & { apiKey?: string endpoint?: string taskId?: string headers?: Record } ``` `OtelExporterConfig`(`provider` と `exporter` を除く)を継承し、次の項目を含みます。 - `timeout?: number` - エクスポートのタイムアウト(ミリ秒、デフォルト:30000) - `batchSize?: number` - バッチあたりの Span 数(デフォルト:512) - `logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error'` - ログレベル(デフォルト:WARN) - `resourceAttributes?: Record` - カスタムリソース属性 ### メタデータの引き渡し 予約されていない Span 属性は OpenInference の `metadata` ペイロードにシリアライズされます。`tracingOptions.metadata`(例:`companyId`、`tier`)から追加します。`input`、`output`、`sessionId`、thread/user ID、OpenInference ID などの予約フィールドは自動的に除外されます。 ## メソッド ### `exportTracingEvent` ```typescript async exportTracingEvent(event: TracingEvent): Promise ``` Tracing イベントを設定済みのエンドポイントへエクスポートします。 ### export ```typescript async export(spans: ReadOnlySpan[]): Promise ``` OpenInference セマンティック規約に従い、OpenTelemetry を使用して Span をバッチエクスポートします。 ### flush ```typescript async flush(): Promise ``` exporter をシャットダウンせず、バッファー内のすべての Span を設定済みエンドポイントへ強制的にフラッシュします。ランタイム終了前に Span が確実にエクスポートされるようにする必要がある、サーバーレス環境で役立ちます。 ### shutdown ```typescript async shutdown(): Promise ``` 保留中のデータをフラッシュし、クライアントをシャットダウンします。 ## 使用方法 ### ゼロコンフィグ(環境変数を使用) ```typescript import { ArthurExporter } from '@mastra/arthur' // Set ARTHUR_API_KEY and ARTHUR_BASE_URL (optionally ARTHUR_TASK_ID) const exporter = new ArthurExporter() ``` ### 明示的な設定 ```typescript import { ArthurExporter } from '@mastra/arthur' const exporter = new ArthurExporter({ apiKey: process.env.ARTHUR_API_KEY!, endpoint: 'http://localhost:3030', taskId: process.env.ARTHUR_TASK_ID, // Optional }) ``` ## `OpenInference` セマンティック規約 ArthurExporter は [OpenInference セマンティック規約](https://github.com/Arize-ai/openinference/tree/main/spec) を生成 AI アプリケーション向けに実装し、異なる Observability プラットフォーム間で標準化された Trace 構造を提供します。 ## タグのサポート ArthurExporter は分類とフィルタリングのための Trace タグ付けをサポートします。タグはルート Span にのみ適用され、OpenInference ネイティブの `tag.tags` セマンティック規約にマッピングされます。 ### 使用方法 ```typescript const result = await agent.generate('Hello', { tracingOptions: { tags: ['production', 'experiment-v2', 'user-request'], }, }) ``` ### タグの保存方法 タグは OpenInference の `tag.tags` 属性を使用して保存されます: ```json { "tag.tags": ["production", "experiment-v2", "user-request"] } ``` ## 関連項目 - [ArthurExporter ドキュメント](https://mastra.zisheng.pro/ja/docs/observability/integrations/exporters/arthur) - [Arthur Engine ドキュメント](https://docs.arthur.ai/) - [Arthur Engine リポジトリ](https://github.com/arthur-ai/arthur-engine)