Anypoint Monitoring Archive API
Metric Data
A metric file contains metric data using streaming JSON lines (JSONL), also known as new-line-delimited JSON (NDJSON) and line-delimited JSON (LDJSON). Each line contains a JSON object. This JSON object contains one or more metrics events. A metric event contains either an individual sampled value or aggregated sampled values from the sampling window.
JSON Fields | Description |
---|---|
{ | |
"format": "v2", | The JSON format version for this batch object. Currently only value is "v2". |
"time": 1552513320000, | Timestamp of the sampling window within which the events in this JSON objects are generated, in milliseconds. |
"type": "api_summary_metric", | Type of events in this JSON. Each JSON only contains metric data of the same type. |
"metadata": { | Metadata about how the data is generated and collected. |
"batch_id": 1, | Each JSON object is limited to a maximum size. When there are more events than what fits in a single JSON object, multiple JSON objects are used. Each JSON object is assigned a unique batch id within the time window. (time, batch_id) together uniquely identifies the JSON object. |
"aggregated": true or false, | When true, each event in the JSON contains aggregated data within the window. Aggregated data is reported using min, max, count, sum, and sum squared. When false, each event represent a single sampled data point. |
"limited": true or false, | When true, the events are a subset representing top occurring events only. When false, the events are not limited to just the top occurring ones. |
"producer_name": "analytics-metrics-collector-mule4", | name of the data producer |
"producer_version": "2.2.0" | version of data collector |
}, | |
"commons": { | A block of common dimensions for every events in this JSON. |
"dimension_name": "string_value" | Each dimension is represented by a name and a String value. |
... | more common dimensions |
} | end of common block |
"events": [ | One or more events in this block |
{ | A single metric event in the form of a map of name and value. A name value pair represents either a dimension or a fact. |
"dimension_name": "string_value" | A dimension for this event with a name and a string value. If the dimension name overlaps a name inside commons block, then the value here takes precedence for this event. |
... | more dimensions |
"fact_name":numeric_value | A fact for this event with a name and a numeric value. |
... | more facts |
}, | end of a single event |
... | more events |
] | end of event array block |
} |
Aggregated Facts
When metrics are collected and aggregated for a time window, an event contains 5 facts for each measurement aggregated. The name of the facts is then made of the measurement and an aggregation suffix.
Fact Name | Description |
---|---|
measurement.min | The minimum value for the sampling window for the measurement |
measurement.max | The maximum value for the sampling window for the measurement |
measurement.count | Total number of events collected for this measurement |
measurement.sum | The sum of measurement values. sum/count produces the mean value for the measurement |
measurement.sos | The sum of value squared. Use this value and the mean to compute variance. |
Example
{
"format": "v2", // version of JSON structure
"time": 1585082947062, // timestamp in milliseconds for events in this object
"type": "api_summary_metric", // metric type for the events in this object
"commons": { // a set common dimensions for all events in this object
"deployment_type": "RTF",
"api_id": "204393",
"cluster_id": "rtf",
"env_id": "env",
"public_ip": "127.0.0.1",
"org_id": "org",
"worker_id": "worker-1"
},
"events": [ // an array of metric events
{ // each event is a map of dimensions and facts
// event dimensions, each with a key and a string value
"method": "POST",
"status_code": "200",
"api_version_id": "223337",
"api_name": "groupId:6046b96d-c9aa-4cb2-9b30-90a54fc01a7b:assetId:policy_sla_rate_limit",
"api_version": "v1:223337",
"client_id": "eb30101d7394407ea86f0643e1c63331",
"request_disposition": "processed",
// event facts, each with a key and a numerical value
// agent captures measurement values and aggregates them based on dimensions and measurement type
// for the sampling window (typically 1 minute). For each measurement type, 5 facts are generated:
//
// <measurement>.count -- number of occurrences withing sampling window
// <measurement>.sum -- sum of values from each occurrence withing sampling window
// <measurement>.max -- max value from occurrences withing sampling window
// <measurement>.min -- min value from occurrence withing sampling window
// <measurement>.sos -- sum of value squared from occurrence withing sampling window, may be used to generate standard deviation
// e.g. 5 facts for response size
"response_size.count": 1,
"response_size.sum": 2,
"response_size.max": 2,
"response_size.min": 2,
"response_size.sos": 4,
// e.g. 5 facts for response time
"response_time.max": 4,
"response_time.min": 4,
"response_time.count": 1,
"response_time.sum": 4,
"response_time.sos": 16,
// e.g. 5 facts for request size
"request_size.min": 6,
"request_size.count": 1,
"request_size.sos": 36,
"request_size.max": 6,
"request_size.sum": 6
},
{ ... }, // another event
{ ... }, // another event
{ ... } // another event
],
"metadata": { // metric data collector meta data
"batch_id": 0, // for the same sampling window, unique identifier for multiple JSON lines
"aggregated": true, // true if the events are aggregated for the sampling window
"limited": false, // true if events form a subset, representing top occurring events for the sampling window
"producer_name": "analytics-metrics-collector-mule3",
"producer_version": "2.2.2-SNAPSHOT"
}
}