2020-07-21 01:33:33 +08:00
|
|
|
{
|
|
|
|
"metrics": {
|
|
|
|
"port": 9145,
|
|
|
|
"definitions": [
|
|
|
|
{
|
|
|
|
"type": "counter",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_requests_total",
|
|
|
|
"help": "MAPS API requests total"
|
|
|
|
},
|
2020-07-21 22:36:23 +08:00
|
|
|
"valuePath": "server_response.statusCode",
|
2020-07-21 01:33:33 +08:00
|
|
|
"shouldMeasure": "({ value }) => Number.isFinite(value)",
|
|
|
|
"measure": "({ metric }) => metric.inc()"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "counter",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_requests_ok_total",
|
|
|
|
"help": "MAPS API requests ok total"
|
|
|
|
},
|
2020-07-21 22:36:23 +08:00
|
|
|
"valuePath": "server_response.statusCode",
|
2020-07-21 01:33:33 +08:00
|
|
|
"shouldMeasure": "({ value }) => value >= 200 && value < 400",
|
|
|
|
"measure": "({ metric }) => metric.inc()"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "counter",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_requests_errors_total",
|
|
|
|
"help": "MAPS API requests errors total"
|
|
|
|
},
|
2020-07-21 22:36:23 +08:00
|
|
|
"valuePath": "server_response.statusCode",
|
2020-07-21 01:33:33 +08:00
|
|
|
"shouldMeasure": "({ value }) => value >= 400",
|
|
|
|
"measure": "({ metric }) => metric.inc()"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "histogram",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_response_time_total",
|
|
|
|
"help": "MAPS API response time total"
|
|
|
|
},
|
|
|
|
"valuePath": "stats.response",
|
|
|
|
"shouldMeasure": "({ value }) => Number.isFinite(value)",
|
|
|
|
"measure": "({ metric, value }) => metric.observe(value)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "counter",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_requests",
|
|
|
|
"help": "MAPS API requests per user",
|
|
|
|
"labelNames": ["user", "http_code"]
|
|
|
|
},
|
2020-07-21 22:36:23 +08:00
|
|
|
"labelPaths": ["cdb-user", "server_response.statusCode"],
|
2020-07-21 01:33:33 +08:00
|
|
|
"shouldMeasure": "({ labels }) => labels.every((label) => label !== undefined)",
|
|
|
|
"measure": "({ metric, labels }) => metric.labels(...labels).inc()"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "counter",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_requests_ok",
|
|
|
|
"help": "MAPS API requests per user with success HTTP code",
|
|
|
|
"labelNames": ["user", "http_code"]
|
|
|
|
},
|
2020-07-21 22:36:23 +08:00
|
|
|
"labelPaths": ["cdb-user", "server_response.statusCode"],
|
|
|
|
"valuePath": "server_response.statusCode",
|
2020-07-21 01:33:33 +08:00
|
|
|
"shouldMeasure": "({ labels, value }) => labels.every((label) => label !== undefined) && value >= 200 && value < 400",
|
|
|
|
"measure": "({ metric, labels }) => metric.labels(...labels).inc()"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "counter",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_requests_errors",
|
|
|
|
"help": "MAPS API requests per user with error HTTP code",
|
|
|
|
"labelNames": ["user", "http_code"]
|
|
|
|
},
|
2020-07-21 22:36:23 +08:00
|
|
|
"labelPaths": ["cdb-user", "server_response.statusCode"],
|
|
|
|
"valuePath": "server_response.statusCode",
|
2020-07-21 01:33:33 +08:00
|
|
|
"shouldMeasure": "({ labels, value }) => labels.every((label) => label !== undefined) && value >= 400",
|
|
|
|
"measure": "({ metric, labels }) => metric.labels(...labels).inc()"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "histogram",
|
|
|
|
"options": {
|
|
|
|
"name": "maps_api_response_time",
|
|
|
|
"help": "MAPS API response time total",
|
|
|
|
"labelNames": ["user"]
|
|
|
|
},
|
2020-07-21 22:36:23 +08:00
|
|
|
"labelPaths": ["cdb-user"],
|
2020-07-21 01:33:33 +08:00
|
|
|
"valuePath": "stats.response",
|
|
|
|
"shouldMeasure": "({ labels, value }) => labels.every((label) => label !== undefined) && Number.isFinite(value)",
|
|
|
|
"measure": "({ metric, labels, value }) => metric.labels(...labels).observe(value)"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|