Skip to main content
Version: 26.01

Performance Monitoring - Read Metric

Endpoint​

/o/apm/metric

Overview​

Returns the aggregate data and the data over time of one metric of a network or device trace. It can also return the attributes of the trace, such as the device and city of the users.

Authentication​

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

Permissions​

Requires performance_monitoring Read permission.

Request Parameters​

ParameterTypeRequiredDescription
app_idStringYesApplication ID.
idStringYesTrace ID, as returned by Performance Monitoring - Read Overview.
typeStringYesTrace type: network or device.
metricStringYesMetric name, for example response_time or duration.
periodString or ArrayYesPeriod value: month, day, yesterday, hour, {number}days such as 30days, or a date range array.
queryJSON String (Object)NoFilter object applied to the data.
bucketStringNoTime bucket. Defaults to daily.
attributesBooleanNoSet to true to also return attribute data.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Examples​

Read a metric for 30 days​

/o/apm/metric?
app_id=6991c75b024cb89cdc04efd2&
api_key=YOUR_API_KEY&
id=TRACE_ID&
type=network&
metric=response_code&
period=30days

Read a metric with attributes​

/o/apm/metric?
app_id=6991c75b024cb89cdc04efd2&
api_key=YOUR_API_KEY&
id=TRACE_ID&
type=network&
metric=response_code&
period=30days&
attributes=true

Response​

Success Response​

{
"aggregate": {
"name": "example.com/demo/",
"id": "TRACE_ID",
"data": {
"response_code": 100
}
},
"overTime": {
"name": "example.com/demo/",
"id": "TRACE_ID",
"data": {
"response_code": {
"2022.4.7": 100
}
}
},
"trace": "example.com/demo/",
"attributes": {
"up.cty": {
"Ankara": {
"c": 3,
"v": 100,
"t": 16
}
}
}
}

Response Fields​

FieldTypeDescription
traceStringName of the trace.
aggregateObjectAggregate data of the metric.
overTimeObjectData of the metric over time.
attributesObjectAttribute data. Only returned when attributes=true.

Error Responses​

  • 400
{
"result": "Unacceptable trace type."
}
  • 400
{
"result": "Trace id not provided."
}
  • 400
{
"result": "Metric not provided."
}
  • 400
{
"result": "Missing request parameter: period"
}
  • 400
{
"result": "Bad request parameter: period"
}
  • 400
{
"result": "Metric data could not be fetched."
}