メインコンテンツへスキップ
POST
/
trace
/
usage
Trace 利用状況
curl --request POST \
  --url https://api.example.com/trace/usage \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_id": "<string>",
  "filter": {
    "op_names": [
      "<string>"
    ],
    "input_refs": [
      "<string>"
    ],
    "output_refs": [
      "<string>"
    ],
    "parent_ids": [
      "<string>"
    ],
    "trace_ids": [
      "<string>"
    ],
    "call_ids": [
      "<string>"
    ],
    "thread_ids": [
      "<string>"
    ],
    "turn_ids": [
      "<string>"
    ],
    "trace_roots_only": true,
    "wb_user_ids": [
      "<string>"
    ],
    "wb_run_ids": [
      "<string>"
    ]
  },
  "query": {
    "$expr": {
      "$and": [
        {
          "$literal": "<string>"
        }
      ]
    }
  },
  "include_costs": false,
  "limit": 10000
}
'
{
  "call_usage": {}
}

承認

Authorization
string
header
必須

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

ボディ

application/json

トレース内の各コールについて、その子孫コールをロールアップした使用量を計算するためのリクエストです。

このエンドポイントは、トレース内の各コールに対する使用量メトリクスを返します。各コールのメトリクスには、そのコール自身の使用量に加えて、すべての子孫コールの使用量の合計が含まれます。コール単位でロールアップされたメトリクスを表示したいトレースビューで使用してください。

注意: 集計のために、条件にマッチしたすべてのコールがメモリに読み込まれます。結果セットが非常に大きい場合(>10k コール)には、より限定的なフィルターを使用するか、アプリケーション側でのページネーションを検討してください。

project_id
string
必須
filter
CallsFilter · object

コールを選択するためのフィルターです。通常は trace_ids を使用して、特定のトレース内のすべてのコールを取得します。

query
Query · object

コールをフィルタリングするための追加のクエリ条件です。

include_costs
boolean
デフォルト:false

true の場合、使用量にコスト計算を含めます。

limit
integer
デフォルト:10000

処理するコールの最大数です。無制限なメモリ使用を防ぐためのセーフティリミットとして機能します。

レスポンス

正常なレスポンス

コールごとの使用量メトリクス(各コールには子孫コールの寄与分も含まれます)を含むレスポンスです。

call_usage
Call Usage · object