Metric Query REST API

Metric Query REST API Use the Metric Query API to query the metrics for different time ranges, frequencies, and, metrics. Like other APM REST APIs, the Metric Query REST API interface uses token-based authentication. For more information on how to obtain the token, see Generate Security Token.
This API contains the following resource:
Resource
Description
Example
/atc/metric/queryMetric
Execute a query for metrics and retrieves the metric values based on specified query criteria and time range. The <QuerySpecifier> can be any combination of Query Specifiers.
POST /atc/metric/queryMetric
You can use the Metric Query REST API to generate APM or non-APM metric data. The public SQL REST API can also be used to generate APM metric data. For more information on generating APM metric data using public SQL REST API, see SQL REST API.
Example:
POST /atc/metric/queryMetric
Payload:
{ "querySpecifier": <QuerySpecifier>, "queryRange": { "endTime": <time(unixTimestamp/seconds)>, // End time of range (default is current time - NOW) "rangeSize": <seconds>, // Width of range to be returned "frequency": <seconds> // Specifies requested frequency (default is 15 seconds) }, "clampSize": <size> // default is 500 } // Example: { "querySpecifier": { "op": "SPEC", "sourceNameSpecifier": { "op": "EXACT", "names": [ "SuperDomain|Custom Metric Host (Virtual)|Custom Metric Process (Virtual)|Custom Metric Agent (Virtual)" ] }, "attributeNameSpecifier": { "op": "REGEX", "pattern": "Enterprise Manager:.*" } }, "queryRange": { "endTime": 1571823645, "rangeSize": 120, "frequency": 15 }, "clampSize": 100 }
Response:
{ "metrics": [{ "id": <MetricId(string)>, "source": <SourceName(string)>, "attribute": <AttributeName(string)>, "attributes": <Attributes_Optinal(NameValue Pairs - strings)>, "type": <type(32bit Integer), "values": [ [<time(unixTimestamp/seconds)>, <interval/seconds>, <min>, <max>, <value>, <count>] // next data point ] } // next metric ] } // Example: { "metrics": [ { "id": "0P-BAB-B-jt9BQG", "source": "SuperDomain|Custom Metric Host (Virtual)|Custom Metric Process (Virtual)|Custom Metric Agent (Virtual)", "attribute": "Enterprise Manager:Overall Capacity (%)", "attributes" : { // attributes are optional "attribName1" : "attribValue1", "hostname" : "test.broadcom.com" }, "type":2050, "values": [ [1518521415, 15, 2, 4, 3, 4], [1518521430, 15, 2, 3, 3, 4], [1518521445, 15, 3, 4, 3, 4], [1518521460, 15, 2, 5, 3, 4], [1518521475, 15, 2, 3, 3, 4], [1518521490, 15, 86, 86, 86, 1], [1518521505, 15, 5, 19, 11, 4], [1518521520, 15, 4, 51, 17, 5], [1518521535, 15, 3, 11, 7, 4]] ] } ] }
Supported Aggregations
The API supports the following aggregate specifiers:
  • Direct MetricSpecifier
  • Bucket MetricSpecifier
Direct MetricSpecifier
TopK:
Get top N worst performing X where examples of X in APM are URLs, Backends, Frontends, and so on.
Examples:
  1. Get top two worst performing URLs
  2. Get top two Memory consuming JVMs
Example:
POST /atc/metric/queryMetric
Payload:
Top two worst performing URLs based on Average Response Time (ms)
{ "querySpecifier": { "op": "SPEC", "sourceNameSpecifier": { "op": "ALL" }, "attributeNameSpecifier": { "op": "REGEX", "pattern": "Frontends*" } }, "queryRange": { "endTime": 1571823645, "rangeSize": 120, "frequency": 15 }, "aggregations": [ { "input": { "op": "TOPK", "limit": "2", "includeAggregateTimeSeries": false } } ] }
Response:
{ "aggregations": { "TOPK": [ { "key": "SuperDomain|Host1|Process1|Agent1|Frontends|Apps|App1|URLs|URL1:Average Response Time (ms)", "ids": [ "p-BQ-B-2gnVbE" ], "metric" : { "sourceName": "SuperDomain|Host1|Process1|Agent1", "type": 268436481, "attributeName": "Frontends|Apps|App1|URLs|URL1:Average Response Time (ms)", "attributes": { "installer": "DXI", "productName": "APM" } }, "values": [ [ 1571823645, 15, 2, 4, 3, 4 ], [ 1571823660, 15, 2, 3, 3, 4 ], [ 1571823675, 15, 3, 4, 3, 4 ], [ 1571823690, 15, 2, 5, 3, 4 ], [ 1571823705, 15, 2, 3, 3, 4 ], [ 1571823720, 15, 86, 86, 86, 1 ], [ 1571823735, 15, 5, 19, 11, 4 ], [ 1571823750, 15, 4, 51, 17, 5 ], [ 1571823765, 15, 3, 11, 7, 4 ] ], "aggregateValues": [ [ 1571823765, 120, 2, 86, 9, 34 ] ] }, { "key": "SuperDomain|Host1|Process1|Agent2|Frontends|Apps|App1|URLs|URL2:Average Response Time (ms)", "ids": [ "q-CS-F-3vnFcr" ], "metric" : { "sourceName": "SuperDomain|Host1|Process1|Agent2", "type": 268436481, "attributeName": "Frontends|Apps|App1|URLs|URL1:Average Response Time (ms)", "attributes": { "installer": "DXI", "productName": "APM" } }, "values": [ [ 1571823645, 15, 2, 4, 3, 4 ], [ 1571823660, 15, 2, 3, 3, 4 ], [ 1571823675, 15, 3, 4, 3, 4 ], [ 1571823690, 15, 2, 5, 3, 4 ], [ 1571823705, 15, 2, 3, 3, 4 ], [ 1571823720, 15, 87, 87, 87, 1 ], [ 1571823735, 15, 5, 21, 13, 4 ], [ 1571823750, 15, 4, 59, 12, 5 ], [ 1571823765, 15, 3, 12, 5, 4 ] ], "aggregateValues": [ [ 1571823765, 120, 2, 87, 8, 34 ] ] } ] } }
BottomK:
Get bottom N worst-performing X where examples of X in APM are URLs, Backends, Frontends, and so on.
Payload:
Bottom two worst performing URLs based on Average Response Time (ms)
{ "querySpecifier": { "op": "SPEC", "sourceNameSpecifier": { "op": "ALL" }, "attributeNameSpecifier": { "op": "REGEX", "pattern": "Frontends\\|Apps\\|[^\\|]*\\|URLs\\|[^\\|]*:Average Response Time \\(ms\\)" } }, "queryRange": { "endTime": 1571823645, "rangeSize": 120, "frequency": 15 }, "aggregations": [ { "input": { "op": "BOTTOMK", "limit": "10", "includeAggregateTimeSeries": true } } ] }
Response:
{ "aggregations": { "BOTTOMK": [ { "key": "SuperDomain|Host1|Process1|Agent2|Frontends|Apps|App1|URLs|URL2:Average Response Time (ms)", "ids": [ "q-CS-F-3vnFcr" ], "metric": { "sourceName": "SuperDomain|Host1|Process1|Agent2", "type": 268436481, "attributeName": "Frontends|Apps|App1|URLs|URL1:Average Response Time (ms)", "attributes": { "installer": "DXI", "productName": "APM" } }, "values": [ [ 1571823645, 15, 2, 4, 3, 4 ], [ 1571823660, 15, 2, 3, 3, 4 ], [ 1571823675, 15, 3, 4, 3, 4 ], [ 1571823690, 15, 2, 5, 3, 4 ], [ 1571823705, 15, 2, 3, 3, 4 ], [ 1571823720, 15, 87, 87, 87, 1 ], [ 1571823735, 15, 5, 21, 13, 4 ], [ 1571823750, 15, 4, 59, 12, 5 ], [ 1571823765, 15, 3, 12, 5, 4 ] ], "aggregateValues": [ [ 1571823765, 120, 2, 87, 8, 34 ] ] }, { "key": "SuperDomain|Host1|Process1|Agent1|Frontends|Apps|App1|URLs|URL1:Average Response Time (ms)", "ids": [ "p-BQ-B-2gnVbE" ], "metric": { "sourceName": "SuperDomain|Host1|Process1|Agent1", "type": 268436481, "attributeName": "Frontends|Apps|App1|URLs|URL1:Average Response Time (ms)", "attributes": { "installer": "DXI", "productName": "APM" } }, "values": [ [ 1571823645, 15, 2, 4, 3, 4 ], [ 1571823660, 15, 2, 3, 3, 4 ], [ 1571823675, 15, 3, 4, 3, 4 ], [ 1571823690, 15, 2, 5, 3, 4 ], [ 1571823705, 15, 2, 3, 3, 4 ], [ 1571823720, 15, 86, 86, 86, 1 ], [ 1571823735, 15, 5, 19, 11, 4 ], [ 1571823750, 15, 4, 51, 17, 5 ], [ 1571823765, 15, 3, 11, 7, 4 ] ], "aggregateValues": [ [ 1571823765, 120, 2, 86, 9, 34 ] ] } ] } }
Bucket MetricSpecifier
Group X into Y and get top N from Y. For example: Get top 10 JVMs serving the maximum requests, where the maximum request is the sum of responses of all the entry points.
Example:
POST /atc/metric/queryMetric
Payload:
Top 2 JVMs based on the Number of Requests Served (Group Frontends into JVMs and get top 10 from JVMs)
{ "querySpecifier": { "op": "SPEC", "sourceNameSpecifier": { "op": "ALL" }, "attributeNameSpecifier": { "op": "AND", "specifiers": [ { "op": "REGEX", "pattern": "Frontends\\|Apps\\|[^\\|]*:Responses Per Interval" }, { "op": "ATTRIBUTE", "expressions": [ { "name": "processType", "values": [ "Java" ], "operator": "MATCHES", "comparator": "LEXICAL" } ] } ] } }, "queryRange": { "endTime": 1571823645, "rangeSize": 30, "frequency": 15 }, "aggregations": [ { "input": { "op": "TOPK", "input": { "op": "BUCKET_ATTRIBUTE", "value": "APPNAME" }, "limit": "10", "includeAggregateTimeSeries": true } } ] }
Supported values for the bucket operation:
Operation(OP)
Value
BUCKET_ATTRIBUTE
<Custom AttributeName>
BUCKET_SOURCE
  • hostname
  • domain
  • Process
  • agent
BUCKET_ATTRIBUTE_NAME
  • metricpath
  • metricname
Response:
{ "aggregations": { "TOPK": [ { "key": "Process1", "ids": [ "p-BQ-B-2gnVbE", "p-BQ-B-2gnVbF" ], "values": [ [ 1571823645, 15, 34, 34, 34, 34 ], [ 1571823660, 15, 27, 27, 27, 27 ] ], "aggregateValues": [ [ 1571823645, 30, 61, 61, 61, 61 ] ] }, { "key": "Process2", "ids": [ "p-BQ-B-2gnVbG", "p-BQ-B-2gnVbH" ], "values": [ [ 1571823645, 15, 24, 24, 24, 24 ], [ 1571823660, 15, 27, 27, 27, 27 ] ], "aggregateValues": [ [ 1571823645, 30, 51, 51, 51, 51 ] ] } ] } }