Skip to main content

Performance Metrics

Query telemetry data with custom aggregations and filters for analytics. This endpoint builds ClickHouse SQL queries from request parameters to provide flexible data analysis.

Endpoint

POST /v1/interactions/performance-metric/distribution

Authentication

This endpoint requires authentication using JWT tokens. Include the token in the Authorization header:

authorization: Bearer {token}

Performance Metric Distribution

Queries telemetry data with custom aggregations and filters for analytics. Builds ClickHouse SQL queries from request parameters.

Endpoint: POST /v1/interactions/performance-metric/distribution

Request Headers:

HeaderValue
authorizationBearer {token}
Content-Typeapplication/json

Request Body

Request Fields:

FieldTypeRequiredDescription
dataTypestring✅ YesClickHouse table to query: TRACES, METRICS, LOGS, or EXCEPTIONS
timeRangeobject✅ YesISO-8601 UTC timestamps with start and end fields
selectarray✅ YesArray of metric functions to calculate
filtersarray❌ NoArray of WHERE clause conditions
groupByarray❌ NoArray of field names or aliases to group by
orderByarray❌ NoArray of sorting specifications
limitnumber❌ NoMaximum rows to return (default: 100)

Time Range Object:

FieldTypeRequiredDescription
startstring✅ YesISO-8601 UTC start timestamp
endstring✅ YesISO-8601 UTC end timestamp

Select Item Object:

FieldTypeRequiredDescription
functionstring✅ YesPredefined metric function (see below)
paramobject❌ NoFunction-specific parameters
aliasstring❌ NoCustom name for result column

Filter Object:

FieldTypeRequiredDescription
fieldstring✅ YesColumn name to filter on (e.g., "span.name", "page.url")
operatorstring✅ YesComparison operator: IN, LIKE, EQ, ADDITIONAL
valuearray✅ YesArray of values to match against

Order By Object:

FieldTypeRequiredDescription
fieldstring✅ YesField or alias name to sort by
directionstring✅ YesSort direction: ASC or DESC

Available Functions

FunctionDescriptionParameters
APDEXCalculates average APDEX score from span attributes, excluding error status codesNone
DURATION_P9999th percentile duration in seconds, excluding errorsNone
DURATION_P9595th percentile duration in seconds, excluding errorsNone
DURATION_P5050th percentile (median) duration in seconds, excluding errorsNone
CRASHCount of crash events (device.crash)None
ANRCount of Application Not Responding events (device.anr)None
FROZEN_FRAMESum of frozen frame counts from span attributesNone
ANALYSED_FRAMESum of analysed frame counts from span attributesNone
UNANALYSED_FRAMESum of unanalysed frame counts from span attributesNone
COLSelects a column directlyparam.field: Column name
TIME_BUCKETGroups timestamps into time bucketsparam.bucket: Bucket size (e.g., "1d", "1h"); param.field: Timestamp column name
CUSTOMExecutes custom ClickHouse expressionparam.expression: SQL expression string
INTERACTION_SUCCESS_COUNTCount of successful interactions (non-error status codes)None
INTERACTION_ERROR_COUNTCount of failed interactions (error status codes)None
INTERACTION_ERROR_DISTINCT_USERSCount of distinct users who encountered errorsNone
USER_CATEGORY_EXCELLENTCount of users in EXCELLENT categoryNone
USER_CATEGORY_GOODCount of users in GOOD categoryNone
USER_CATEGORY_AVERAGECount of users in AVERAGE categoryNone
USER_CATEGORY_POORCount of users in POOR categoryNone
NET_0Sum of network connection errors (network.0 events)None
NET_2XXSum of successful HTTP responses (2xx status codes)None
NET_3XXSum of redirect responses (3xx status codes)None
NET_4XXSum of client error responses (4xx status codes)None
NET_5XXSum of server error responses (5xx status codes)None
ARR_TO_STRConverts array to comma-separated stringparam.field: Array column name

Example Request

POST /v1/interactions/performance-metric/distribution
authorization: Bearer {token}
Content-Type: application/json

{
"dataType": "TRACES",
"timeRange": {
"start": "2025-11-07T08:40:00Z",
"end": "2025-11-12T14:40:00Z"
},
"select": [
{ "function": "COL", "param": {"field": "os.version"}, "alias": "osVersion"},
{ "function": "DURATION_P99", "alias": "duration_p99"},
{ "function": "APDEX"},
{ "function": "TIME_BUCKET", "param": {"bucket": "1d", "field": "Timestamp"}, "alias": "t1"},
{ "function": "CUSTOM", "param": { "expression": "countIf(StatusCode!='Error')"}, "alias": "success_count"}
],
"filters": [
{ "field": "span.name", "operator": "IN", "value": ["page_load"] },
{ "field": "page.url", "operator": "LIKE", "value": ["https%://my-store.com/checkout/%"] }
],
"groupBy": [
"osVersion"
],
"orderBy": [
{ "field": "t1", "direction": "ASC" },
{ "field": "apdex", "direction": "ASC" }
],
"limit": 1000
}

Response

Response Fields:

FieldTypeDescription
statusnumberHTTP status code
data.fieldsstring[]Column names in the result set
data.rowsarray[]Array of result rows, each row is an array matching field order
errorstring | nullError message if request failed, null on success

Example Response:

{
"status": 200,
"data": {
"fields": ["osVersion", "duration_p99", "apdex", "t1", "success_count"],
"rows": [
["1.0_1", "0.547", "0.68", "2025-11-08T08:40:00Z", "24"],
["1.0_2", "0.566", "0.677", "2025-11-09T08:40:00Z", "23"]
]
},
"error": null
}