메인 콘텐츠로 건너뛰기
POST
/
agents
/
spans
/
stats
GenAI span 통계
curl --request POST \
  --url https://api.example.com/agents/spans/stats \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_id": "<string>",
  "start": "2023-11-07T05:31:56Z",
  "bucket_by": {
    "type": "time"
  },
  "end": "2023-11-07T05:31:56Z",
  "granularity": 1,
  "group_by": [
    {
      "key": "<string>",
      "alias": "<string>",
      "source": "field"
    }
  ],
  "group_filters": [
    {
      "measure": {
        "alias": "<string>",
        "filter": {
          "$expr": {
            "$and": [
              {
                "$literal": "<string>"
              }
            ]
          }
        },
        "value": {
          "key": "<string>",
          "source": "field"
        }
      },
      "group_by": [
        {
          "key": "<string>",
          "alias": "<string>",
          "source": "field"
        }
      ],
      "max": 123,
      "min": 123
    }
  ],
  "group_limit": 50,
  "metrics": [
    {
      "alias": "<string>",
      "value": {
        "key": "<string>",
        "source": "field"
      },
      "aggregations": [],
      "percentiles": [
        123
      ]
    }
  ],
  "query": {
    "$expr": {
      "$and": [
        {
          "$literal": "<string>"
        }
      ]
    }
  },
  "timezone": "UTC"
}
'
import requests

url = "https://api.example.com/agents/spans/stats"

payload = {
"project_id": "<string>",
"start": "2023-11-07T05:31:56Z",
"bucket_by": { "type": "time" },
"end": "2023-11-07T05:31:56Z",
"granularity": 1,
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"group_filters": [
{
"measure": {
"alias": "<string>",
"filter": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"value": {
"key": "<string>",
"source": "field"
}
},
"group_by": [
{
"key": "<string>",
"alias": "<string>",
"source": "field"
}
],
"max": 123,
"min": 123
}
],
"group_limit": 50,
"metrics": [
{
"alias": "<string>",
"value": {
"key": "<string>",
"source": "field"
},
"aggregations": [],
"percentiles": [123]
}
],
"query": { "$expr": { "$and": [{ "$literal": "<string>" }] } },
"timezone": "UTC"
}
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>',
start: '2023-11-07T05:31:56Z',
bucket_by: {type: 'time'},
end: '2023-11-07T05:31:56Z',
granularity: 1,
group_by: [{key: '<string>', alias: '<string>', source: 'field'}],
group_filters: [
{
measure: {
alias: '<string>',
filter: {$expr: {$and: [{$literal: '<string>'}]}},
value: {key: '<string>', source: 'field'}
},
group_by: [{key: '<string>', alias: '<string>', source: 'field'}],
max: 123,
min: 123
}
],
group_limit: 50,
metrics: [
{
alias: '<string>',
value: {key: '<string>', source: 'field'},
aggregations: [],
percentiles: [123]
}
],
query: {$expr: {$and: [{$literal: '<string>'}]}},
timezone: 'UTC'
})
};

fetch('https://api.example.com/agents/spans/stats', 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/agents/spans/stats",
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>',
'start' => '2023-11-07T05:31:56Z',
'bucket_by' => [
'type' => 'time'
],
'end' => '2023-11-07T05:31:56Z',
'granularity' => 1,
'group_by' => [
[
'key' => '<string>',
'alias' => '<string>',
'source' => 'field'
]
],
'group_filters' => [
[
'measure' => [
'alias' => '<string>',
'filter' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'value' => [
'key' => '<string>',
'source' => 'field'
]
],
'group_by' => [
[
'key' => '<string>',
'alias' => '<string>',
'source' => 'field'
]
],
'max' => 123,
'min' => 123
]
],
'group_limit' => 50,
'metrics' => [
[
'alias' => '<string>',
'value' => [
'key' => '<string>',
'source' => 'field'
],
'aggregations' => [

],
'percentiles' => [
123
]
]
],
'query' => [
'$expr' => [
'$and' => [
[
'$literal' => '<string>'
]
]
]
],
'timezone' => 'UTC'
]),
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/agents/spans/stats"

payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"start\": \"2023-11-07T05:31:56Z\",\n \"bucket_by\": {\n \"type\": \"time\"\n },\n \"end\": \"2023-11-07T05:31:56Z\",\n \"granularity\": 1,\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"group_limit\": 50,\n \"metrics\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"aggregations\": [],\n \"percentiles\": [\n 123\n ]\n }\n ],\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"timezone\": \"UTC\"\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/agents/spans/stats")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"start\": \"2023-11-07T05:31:56Z\",\n \"bucket_by\": {\n \"type\": \"time\"\n },\n \"end\": \"2023-11-07T05:31:56Z\",\n \"granularity\": 1,\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"group_limit\": 50,\n \"metrics\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"aggregations\": [],\n \"percentiles\": [\n 123\n ]\n }\n ],\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"timezone\": \"UTC\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/agents/spans/stats")

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 \"start\": \"2023-11-07T05:31:56Z\",\n \"bucket_by\": {\n \"type\": \"time\"\n },\n \"end\": \"2023-11-07T05:31:56Z\",\n \"granularity\": 1,\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"group_filters\": [\n {\n \"measure\": {\n \"alias\": \"<string>\",\n \"filter\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n }\n },\n \"group_by\": [\n {\n \"key\": \"<string>\",\n \"alias\": \"<string>\",\n \"source\": \"field\"\n }\n ],\n \"max\": 123,\n \"min\": 123\n }\n ],\n \"group_limit\": 50,\n \"metrics\": [\n {\n \"alias\": \"<string>\",\n \"value\": {\n \"key\": \"<string>\",\n \"source\": \"field\"\n },\n \"aggregations\": [],\n \"percentiles\": [\n 123\n ]\n }\n ],\n \"query\": {\n \"$expr\": {\n \"$and\": [\n {\n \"$literal\": \"<string>\"\n }\n ]\n }\n },\n \"timezone\": \"UTC\"\n}"

response = http.request(request)
puts response.read_body
{
  "end": "2023-11-07T05:31:56Z",
  "start": "2023-11-07T05:31:56Z",
  "timezone": "<string>",
  "bucket_type": "time",
  "columns": [
    {
      "name": "<string>",
      "aggregation": "<string>",
      "metric": "<string>"
    }
  ],
  "granularity": 123,
  "rows": [
    {}
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

인증

Authorization
string
header
필수

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

본문

application/json

GenAI 에이전트 span에 대해 chart용 집계를 요청합니다.

project_id
string
필수
start
string<date-time>
필수
bucket_by
AgentSpanStatsTimeBucketSpec · object

started_at 시간 간격을 기준으로 통계 행을 버킷팅합니다.

end
string<date-time> | null
granularity
integer | null
필수 범위: x > 0
group_by
AgentGroupByRef · object[]
group_filters
AgentSpanGroupFilter · object[]
group_limit
integer
기본값:50
필수 범위: 1 <= x <= 1000
metrics
AgentSpanStatsMetricSpec · object[]
query
Query · object | null
timezone
string
기본값:UTC

응답

성공 응답

chart용 에이전트 span 통계 행을 포함하는 응답입니다.

end
string<date-time>
필수
start
string<date-time>
필수
timezone
string
필수
bucket_type
enum<string>
기본값:time
사용 가능한 옵션:
time,
number
columns
AgentSpanStatsColumn · object[]
granularity
integer | null
rows
Rows · object[]