Skip to main content
Version: 24.05

Performance Monitoring - Metric Data

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint​

/o/apm/metric

Overview​

Returns the aggregated and over-time data of one metric of a network or device trace, optionally filtered by a user query and with a breakdown by user attributes.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

  • Requires Read permission for the Performance Monitoring feature (performance_monitoring) in the target app.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesID of the app the trace belongs to.
idStringYesTrace ID, as returned in the id field of the traces listed by the Performance Monitoring read endpoints.
typeStringYesTrace type, network or device.
metricStringYesName of the metric, for example response_time or duration.
periodStringYesPeriod of the data: month, day, yesterday, hour, NUMBERdays (for example 30days) or a custom range as a JSON array.
bucketStringNodaily (default) or hourly.
attributesStringNoSet to true to also return the data broken down by user attributes.
queryString (JSON)NoFilter on the samples, as a JSON user query.

Examples​

Example: Read a metric of a network trace​

curl "https://your-server.com/o/apm/metric?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&id=TRACE_ID&type=network&metric=response_code&period=30days&attributes=true"

Response​

Success Response​

{
"aggregate": {
"name": "example.com/demo/",
"id": "9d232097a7b4ca58a6a70b6199a37239:5db26f32df77f701429269d7c11dfac61cc8fd1f0fa44d7bb7f70d462d2af0da",
"data": {
"response_code": 100
}
},
"overTime": {
"name": "example.com/demo/",
"id": "33f58230c12602b45f3d62afd7f69cee:1fee05c8058f5b75534ca43cf0c372ae8f6f1eeabc145c4a43ee9d22c3a924b9",
"data": {
"response_code": {
"2022.4.7": 100
}
}
},
"trace": "example.com/demo/",
"attributes": {
"up.d": {
"Unknown": {
"c": 16,
"v": 100,
"t": 16
}
}
}
}

Response Fields​

FieldTypeDescription
traceStringName of the trace.
aggregateObjectAggregated data of the metric for the whole period.
overTimeObjectData of the metric over time.
attributesObjectOnly with attributes=true and when sample-level data is stored for the app. Keyed by user attribute (up.d, up.cty, up.rgn, up.cc, up.p, up.pv, up.av, up.c, up.brw, up.brwv), then by attribute value. Each value has c (number of samples), v (value of the metric) and t (total samples).

Error Responses​

  • HTTP 400 - Invalid request:
{
"result": "Unacceptable trace type."
}

Other messages for HTTP 400: Trace id not provided., Metric not provided., Missing request parameter: period, Bad request parameter: period, Metric data could not be fetched.. A query that cannot be parsed is also rejected with HTTP 400.

Behavior​

  • Without sample-level data stored for the app, the endpoint reads the aggregated trace data and query and attributes have no effect.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.apmAggregated trace dataReads aggregated trace data.
Drill events collection of the trace typeSamplesReads the samples of the trace in the period.