Skip to main content
Version: 25.03

Performance Monitoring - Samples Read

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/samples

Overview​

Returns a page of the recorded samples of one metric of a trace, newest first.

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.
typeStringYesTrace type: network or device.
idStringYesTrace ID, as returned in the id field of traces by Overview Read.
metricStringYesName of the metric, for example response_time or duration.
periodString or ArrayYesmonth, day, yesterday, hour, <number>days (for example 30days), or a custom range as a JSON array.
queryJSON String (Object)NoFilter on the samples, in the same format as the Drill queryObject.
iDisplayStartNumberNoNumber of samples to skip. Default is 0.
iDisplayLengthNumberNoNumber of samples to return. Default is 10.
sEchoStringNoCounter that is returned unchanged in the response.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.

Examples​

Read the first samples of a trace​

/o/apm/samples?
app_id=6991c75b024cb89cdc04efd2&
api_key=YOUR_API_KEY&
type=network&
id=TRACE_ID&
metric=response_time&
period=30days&
iDisplayLength=10

Response​

Success Response​

{
"sEcho": "1",
"iTotalRecords": 120,
"iTotalDisplayRecords": 120,
"aaData": []
}

Response Fields​

FieldTypeDescription
sEchoStringThe sEcho value of the request.
iTotalRecordsNumberTotal number of samples that match the request.
iTotalDisplayRecordsNumberSame value as iTotalRecords.
aaDataArrayThe samples of the requested page.

If the server has no Drill database, the response is {"trace": "<trace name>", "ts": 0, "samples": []}.

Error Responses​

The request is validated like Metric Read; its 400 errors apply here too. A failed read returns:

{
"result": "Samples data could not be fetched."
}