트레이스 사용량
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": {
"call_ids": [
"<string>"
],
"input_refs": [
"<string>"
],
"op_names": [
"<string>"
],
"output_refs": [
"<string>"
],
"parent_ids": [
"<string>"
],
"thread_ids": [
"<string>"
],
"trace_ids": [
"<string>"
],
"trace_roots_only": true,
"turn_ids": [
"<string>"
],
"wb_run_ids": [
"<string>"
],
"wb_user_ids": [
"<string>"
]
},
"include_costs": false,
"limit": 10000,
"query": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
}
}
'import requests
url = "https://api.example.com/trace/usage"
payload = {
"project_id": "<string>",
"filter": {
"call_ids": ["<string>"],
"input_refs": ["<string>"],
"op_names": ["<string>"],
"output_refs": ["<string>"],
"parent_ids": ["<string>"],
"thread_ids": ["<string>"],
"trace_ids": ["<string>"],
"trace_roots_only": True,
"turn_ids": ["<string>"],
"wb_run_ids": ["<string>"],
"wb_user_ids": ["<string>"]
},
"include_costs": False,
"limit": 10000,
"query": { "$expr": { "$and": [{ "$literal": "<string>" }] } }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
filter: {
call_ids: ['<string>'],
input_refs: ['<string>'],
op_names: ['<string>'],
output_refs: ['<string>'],
parent_ids: ['<string>'],
thread_ids: ['<string>'],
trace_ids: ['<string>'],
trace_roots_only: true,
turn_ids: ['<string>'],
wb_run_ids: ['<string>'],
wb_user_ids: ['<string>']
},
include_costs: false,
limit: 10000,
query: {$expr: {$and: [{$literal: '<string>'}]}}
})
};
fetch('https://api.example.com/trace/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/trace/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_id' => '<string>',
'filter' => [
'call_ids' => [
'<string>'
],
'input_refs' => [
'<string>'
],
'op_names' => [
'<string>'
],
'output_refs' => [
'<string>'
],
'parent_ids' => [
'<string>'
],
'thread_ids' => [
'<string>'
],
'trace_ids' => [
'<string>'
],
'trace_roots_only' => true,
'turn_ids' => [
'<string>'
],
'wb_run_ids' => [
'<string>'
],
'wb_user_ids' => [
'<string>'
]
],
'include_costs' => false,
'limit' => 10000,
'query' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/trace/usage"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"filter\": {\n \"call_ids\": [\n \"<string>\"\n ],\n \"input_refs\": [\n \"<string>\"\n ],\n \"op_names\": [\n \"<string>\"\n ],\n \"output_refs\": [\n \"<string>\"\n ],\n \"parent_ids\": [\n \"<string>\"\n ],\n \"thread_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"trace_roots_only\": true,\n \"turn_ids\": [\n \"<string>\"\n ],\n \"wb_run_ids\": [\n \"<string>\"\n ],\n \"wb_user_ids\": [\n \"<string>\"\n ]\n },\n \"include_costs\": false,\n \"limit\": 10000,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/trace/usage")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"filter\": {\n \"call_ids\": [\n \"<string>\"\n ],\n \"input_refs\": [\n \"<string>\"\n ],\n \"op_names\": [\n \"<string>\"\n ],\n \"output_refs\": [\n \"<string>\"\n ],\n \"parent_ids\": [\n \"<string>\"\n ],\n \"thread_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"trace_roots_only\": true,\n \"turn_ids\": [\n \"<string>\"\n ],\n \"wb_run_ids\": [\n \"<string>\"\n ],\n \"wb_user_ids\": [\n \"<string>\"\n ]\n },\n \"include_costs\": false,\n \"limit\": 10000,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/trace/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"filter\": {\n \"call_ids\": [\n \"<string>\"\n ],\n \"input_refs\": [\n \"<string>\"\n ],\n \"op_names\": [\n \"<string>\"\n ],\n \"output_refs\": [\n \"<string>\"\n ],\n \"parent_ids\": [\n \"<string>\"\n ],\n \"thread_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"trace_roots_only\": true,\n \"turn_ids\": [\n \"<string>\"\n ],\n \"wb_run_ids\": [\n \"<string>\"\n ],\n \"wb_user_ids\": [\n \"<string>\"\n ]\n },\n \"include_costs\": false,\n \"limit\": 10000,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"call_usage": {},
"unfinished_call_ids": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}트레이스의 call별 사용량을 하위 항목 롤업과 함께 계산합니다.
POST
/
trace
/
usage
트레이스 사용량
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": {
"call_ids": [
"<string>"
],
"input_refs": [
"<string>"
],
"op_names": [
"<string>"
],
"output_refs": [
"<string>"
],
"parent_ids": [
"<string>"
],
"thread_ids": [
"<string>"
],
"trace_ids": [
"<string>"
],
"trace_roots_only": true,
"turn_ids": [
"<string>"
],
"wb_run_ids": [
"<string>"
],
"wb_user_ids": [
"<string>"
]
},
"include_costs": false,
"limit": 10000,
"query": {
"$expr": {
"$and": [
{
"$literal": "<string>"
}
]
}
}
}
'import requests
url = "https://api.example.com/trace/usage"
payload = {
"project_id": "<string>",
"filter": {
"call_ids": ["<string>"],
"input_refs": ["<string>"],
"op_names": ["<string>"],
"output_refs": ["<string>"],
"parent_ids": ["<string>"],
"thread_ids": ["<string>"],
"trace_ids": ["<string>"],
"trace_roots_only": True,
"turn_ids": ["<string>"],
"wb_run_ids": ["<string>"],
"wb_user_ids": ["<string>"]
},
"include_costs": False,
"limit": 10000,
"query": { "$expr": { "$and": [{ "$literal": "<string>" }] } }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
project_id: '<string>',
filter: {
call_ids: ['<string>'],
input_refs: ['<string>'],
op_names: ['<string>'],
output_refs: ['<string>'],
parent_ids: ['<string>'],
thread_ids: ['<string>'],
trace_ids: ['<string>'],
trace_roots_only: true,
turn_ids: ['<string>'],
wb_run_ids: ['<string>'],
wb_user_ids: ['<string>']
},
include_costs: false,
limit: 10000,
query: {$expr: {$and: [{$literal: '<string>'}]}}
})
};
fetch('https://api.example.com/trace/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/trace/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_id' => '<string>',
'filter' => [
'call_ids' => [
'<string>'
],
'input_refs' => [
'<string>'
],
'op_names' => [
'<string>'
],
'output_refs' => [
'<string>'
],
'parent_ids' => [
'<string>'
],
'thread_ids' => [
'<string>'
],
'trace_ids' => [
'<string>'
],
'trace_roots_only' => true,
'turn_ids' => [
'<string>'
],
'wb_run_ids' => [
'<string>'
],
'wb_user_ids' => [
'<string>'
]
],
'include_costs' => false,
'limit' => 10000,
'query' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/trace/usage"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"filter\": {\n \"call_ids\": [\n \"<string>\"\n ],\n \"input_refs\": [\n \"<string>\"\n ],\n \"op_names\": [\n \"<string>\"\n ],\n \"output_refs\": [\n \"<string>\"\n ],\n \"parent_ids\": [\n \"<string>\"\n ],\n \"thread_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"trace_roots_only\": true,\n \"turn_ids\": [\n \"<string>\"\n ],\n \"wb_run_ids\": [\n \"<string>\"\n ],\n \"wb_user_ids\": [\n \"<string>\"\n ]\n },\n \"include_costs\": false,\n \"limit\": 10000,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/trace/usage")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"filter\": {\n \"call_ids\": [\n \"<string>\"\n ],\n \"input_refs\": [\n \"<string>\"\n ],\n \"op_names\": [\n \"<string>\"\n ],\n \"output_refs\": [\n \"<string>\"\n ],\n \"parent_ids\": [\n \"<string>\"\n ],\n \"thread_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"trace_roots_only\": true,\n \"turn_ids\": [\n \"<string>\"\n ],\n \"wb_run_ids\": [\n \"<string>\"\n ],\n \"wb_user_ids\": [\n \"<string>\"\n ]\n },\n \"include_costs\": false,\n \"limit\": 10000,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/trace/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_id\": \"<string>\",\n \"filter\": {\n \"call_ids\": [\n \"<string>\"\n ],\n \"input_refs\": [\n \"<string>\"\n ],\n \"op_names\": [\n \"<string>\"\n ],\n \"output_refs\": [\n \"<string>\"\n ],\n \"parent_ids\": [\n \"<string>\"\n ],\n \"thread_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"trace_roots_only\": true,\n \"turn_ids\": [\n \"<string>\"\n ],\n \"wb_run_ids\": [\n \"<string>\"\n ],\n \"wb_user_ids\": [\n \"<string>\"\n ]\n },\n \"include_costs\": false,\n \"limit\": 10000,\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"call_usage": {},
"unfinished_call_ids": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}인증
HTTPBasicHTTPBearer
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
본문
application/json
하위 항목 롤업을 포함해 트레이스의 call별 사용량을 계산하기 위한 요청입니다.
이 Endpoint는 트레이스의 각 call에 대한 사용 메트릭을 반환하며, 각 call의 메트릭에는 해당 call 자체의 사용량과 모든 하위 항목의 사용량 합계가 포함됩니다. call별 롤업 메트릭을 확인하려는 Trace view에 사용하세요.
참고: 집계를 위해 일치하는 모든 call을 메모리에 로드합니다. 결과 집합이 매우 큰 경우 (1만 call 초과)에는 더 구체적인 필터를 사용하거나 애플리케이션 계층에서 페이지네이션을 사용하는 것을 고려하세요.
선택할 call을 지정하는 필터입니다. 일반적으로 트레이스의 모든 call을 가져오려면 trace_ids를 사용합니다.
Show child attributes
Show child attributes
true이면 사용량에 비용 계산을 포함합니다.
처리할 최대 call 수입니다. 제한 없이 메모리를 사용하는 것을 방지하기 위한 안전 제한으로 작동합니다.
call을 필터링하기 위한 추가 쿼리 조건입니다.
Show child attributes
Show child attributes
⌘I