2.2 KiB
2.2 KiB
Metricator's API
This page describes Metricator's API.
URL forming
API URLs are formed like: /api/vX/TYPE/OTHER_DATA, where:
vXis a version (e.g.v1).TYPE- request type (see below).OTHER_DATA- other data that is needed to properly process request ofTYPE.
Versions
Metricator's API currently supports API version 1.
Handlers
Get Metricator's build info
URL: /api/vX/info
Returns a JSON with build info with following items:
Branchfor git branch.Buildfor commit number.CommitHashfor git commit hash.Versionfor tagged (or not tagged) build.
Caveats:
Versioncontains string formed with Semantic Versioning in mind, so there is either "X.Y.Z" for tagged release or "X.Y.Z-dev` for development (built not from tag) release.
Example:
{"Branch":"master","Build":"24","CommitHash":"095e24a2b0b908d790153a4ed0bee51d9dba7685","Version":"0.1.0-dev"}
Get registered applications list
URL: /api/vX/apps_list
Returns a JSON with all known applications.
Example:
["app1", "app2", "gw1", "gw2"]
Get all known metrics for application
URL: /api/vX/metrics/APP_NAME
Where:
APP_NAMEis a name of registered application.
Example:
[
{
"Name":"dnsdist_frontend_tcpgaveup/frontend:127.0.0.1:53/proto:TCP/thread:0",
"Description":"Amount of TCP connections terminated after too many attempts to get a connection to the backend",
"Type":"counter",
"Value":"0",
"Params":null
},
{
"Name":"dnsdist_frontend_queries/frontend:127.0.0.1:53/proto:UDP/thread:0",
"Description":"Amount of queries received by this frontend",
"Type":"counter",
"Value":"0",
"Params":null
},
{
"Name":"dnsdist_frontend_queries/frontend:127.0.0.1:53/proto:UDP/thread:0",
"Description":"Amount of queries received by this frontend",
"Type":"counter",
"Value":"53842",
"Params":null,
}
]
Get single metric data
URL: /api/vX/metrics/APP_NAME/METRIC_NAME
Where:
APP_NAMEis a name of registered application.METRIC_NAMEis a name of metric exposed by this application.