CartoDB-SQL-API/metro/config.json

95 lines
4.1 KiB
JSON
Raw Normal View History

{
"metrics": {
"port": 9144,
"definitions": [
{
"type": "counter",
"options": {
"name": "sql_api_requests_total",
"help": "SQL API requests total"
},
"valuePath": "server_response.statusCode",
"shouldMeasure": "({ value }) => Number.isFinite(value)",
"measure": "({ metric }) => metric.inc()"
},
{
"type": "counter",
"options": {
"name": "sql_api_requests_ok_total",
"help": "SQL API requests ok total"
},
"valuePath": "server_response.statusCode",
"shouldMeasure": "({ value }) => value >= 200 && value < 400",
"measure": "({ metric }) => metric.inc()"
},
{
"type": "counter",
"options": {
"name": "sql_api_requests_errors_total",
"help": "SQL API requests errors total"
},
"valuePath": "server_response.statusCode",
"shouldMeasure": "({ value }) => value >= 400",
"measure": "({ metric }) => metric.inc()"
},
{
"type": "histogram",
"options": {
"name": "sql_api_response_time_total",
"help": "SQL API response time total"
},
"valuePath": "stats.response",
"shouldMeasure": "({ value }) => Number.isFinite(value)",
"measure": "({ metric, value }) => metric.observe(value)"
},
{
"type": "counter",
"options": {
"name": "sql_api_requests",
"help": "SQL API requests per user",
"labelNames": ["user", "http_code"]
},
"labelPaths": ["cdb-user", "server_response.statusCode"],
"shouldMeasure": "({ labels }) => labels.every((label) => label !== undefined)",
"measure": "({ metric, labels }) => metric.labels(...labels).inc()"
},
{
"type": "counter",
"options": {
"name": "sql_api_requests_ok",
"help": "SQL API requests per user with success HTTP code",
"labelNames": ["user", "http_code"]
},
"labelPaths": ["cdb-user", "server_response.statusCode"],
"valuePath": "server_response.statusCode",
"shouldMeasure": "({ labels, value }) => labels.every((label) => label !== undefined) && value >= 200 && value < 400",
"measure": "({ metric, labels }) => metric.labels(...labels).inc()"
},
{
"type": "counter",
"options": {
"name": "sql_api_requests_errors",
"help": "SQL API requests per user with error HTTP code",
"labelNames": ["user", "http_code"]
},
"labelPaths": ["cdb-user", "server_response.statusCode"],
"valuePath": "server_response.statusCode",
"shouldMeasure": "({ labels, value }) => labels.every((label) => label !== undefined) && value >= 400",
"measure": "({ metric, labels }) => metric.labels(...labels).inc()"
},
{
"type": "histogram",
"options": {
"name": "sql_api_response_time",
"help": "SQL API response time total",
"labelNames": ["user"]
},
"labelPaths": ["cdb-user"],
"valuePath": "stats.response",
"shouldMeasure": "({ labels, value }) => labels.every((label) => label !== undefined) && Number.isFinite(value)",
"measure": "({ metric, labels, value }) => metric.labels(...labels).observe(value)"
}
]
}
}