Skip to main content
POST
/
v5
/
spans
/
metrics
/
by-span
Get aggregated metrics grouped by span name
curl --request POST \
  --url https://api.egp.scale.com/v5/spans/metrics/by-span \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "parents_only": true,
  "span_ids": [
    "<string>"
  ],
  "trace_ids": [
    "<string>"
  ],
  "excluded_span_ids": [
    "<string>"
  ],
  "excluded_trace_ids": [
    "<string>"
  ],
  "group_id": "<string>",
  "names": [
    "<string>"
  ],
  "statuses": [
    "SUCCESS"
  ],
  "types": [
    "TEXT_INPUT"
  ],
  "search_texts": [
    "<string>"
  ],
  "extra_metadata": {},
  "application_variant_ids": [
    "<string>"
  ],
  "assessment_types": [
    "<string>"
  ],
  "min_duration_ms": 123,
  "max_duration_ms": 123,
  "limit": 100,
  "offset": 0
}'
{
  "items": [
    {
      "span_name": "<string>",
      "count": 123,
      "min_ms": 123,
      "avg_ms": 123,
      "p50_ms": 123,
      "p90_ms": 123,
      "p95_ms": 123,
      "p99_ms": 123,
      "max_ms": 123,
      "total_ms": 123,
      "total_time_pct": 123,
      "avg_per_trace": 123
    }
  ],
  "totals": {
    "total_traces": 123,
    "total_spans": 123
  }
}

Authorizations

x-api-key
string
header
required

Headers

x-selected-account-id
string | null

Query Parameters

from_ts
string<date-time> | null

The starting (oldest) timestamp in ISO format.

to_ts
string<date-time> | null

The ending (most recent) timestamp in ISO format.

Body

application/json
parents_only
boolean

Only fetch spans that are the top-level (ie. have no parent_id)

span_ids
string[]

Filter by span IDs

trace_ids
string[]

Filter by trace IDs

excluded_span_ids
string[]

List of span IDs to exclude from results

excluded_trace_ids
string[]

List of trace IDs to exclude from results

group_id
string

Filter by group ID

names
string[]

Filter by trace/span name

statuses
enum<string>[]

Filter on span status

types
enum<string>[]
search_texts
string[]

Free text search across span input and output fields

extra_metadata
object

Filter on custom metadata key-value pairs

application_variant_ids
string[]

Filter by application variant IDs

assessment_types
string[]

Filter spans by traces that have assessments of these types

min_duration_ms
integer

Minimum span duration in milliseconds (inclusive)

max_duration_ms
integer

Maximum span duration in milliseconds (inclusive)

limit
integer
default:100

Max number of span groups to return

offset
integer
default:0

Offset for pagination of span groups

Response

Successful Response

items
SpansBySpanMetricsItem · object[]
required
totals
object
required
I