Metrics API
This page is part of MariaDB's Documentation.
The parent of this page is: Observability API
Topics on this page:
Overview
The Metrics API exposes SkySQL Monitoring metrics data in OpenMetrics format for ingestion to third-party API platforms (Application Performance Monitoring platforms).
The Metrics API is accessed by REST client.
The Metrics API is part of the Observability API.
Authentication
Generate an API Key
Before using the Metrics API, a SkySQL API Key must be generated. The SkySQL API Key must have the Observability API: Read key scope.
For additional information, see "Generate a SkySQL API Key".
Obtain a Bearer Token
The SkySQL API Key is not used directly with the Metrics API. Instead, the SkySQL API Key is used to request a short-lived bearer token from MariaDB ID, and the short-lived bearer token is used with the Metrics API.
For example, to request a bearer token using cURL with the output piped to jq
for readability:
$ curl --location --request POST \
--header 'Authorization: Token SKYSQL_API_KEY' \
--header 'Content-length: 0' \
https://id.mariadb.com/api/v1/token/ \
| jq .
For additional information, see "Request a Bearer Token".
Make API calls
When making API calls, the short-lived bearer token must be provided in a header using the format Authorization: Bearer SKYSQL_BEARER_TOKEN
, where SKYSQL_BEARER_TOKEN
is the short-lived bearer token.
For example, to call the Log List endpoint using cURL:
$ curl --location --request GET \
--header "Authorization: Bearer SKYSQL_BEARER_TOKEN" \
'https://api.mariadb.com/observability/v1/metrics'
Scrape Interface
Detail | Description |
---|---|
Endpoint | https://api.mariadb.com/observability/v1/metrics
|
Method |
|
Behavior |
|
Parameters |
|
Response Code |
|
Sample Request | https://api.mariadb.com/observability/v1/metrics
|
Command-Line Example | $ curl --location --request GET \
--header "Authorization: Bearer SKYSQL_BEARER_TOKEN" \
'https://api.mariadb.com/observability/v1/metrics?service=cs'
|
Sample Response | # TYPE mariadb_global_status_aborted_clients gauge
mariadb_global_status_aborted_clients{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", topology_type="standalone"} 0 1659041397988
# TYPE mariadb_global_status_aborted_connects gauge
mariadb_global_status_aborted_connects{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", topology_type="standalone"} 2398 1659041397988
# TYPE mariadb_global_status_buffer_pool_pages gauge
mariadb_global_status_buffer_pool_pages{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", state="data", topology_type="standalone"} 294 1659041397988
mariadb_global_status_buffer_pool_pages{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", state="dirty", topology_type="standalone"} 20 1659041397988
mariadb_global_status_buffer_pool_pages{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", state="flushed", topology_type="standalone"} 0 1659041397988
mariadb_global_status_buffer_pool_pages{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", state="free", topology_type="standalone"} 32154 1659041397988
mariadb_global_status_buffer_pool_pages{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", state="misc", topology_type="standalone"} 0 1659041397988
mariadb_global_status_buffer_pool_pages{namespace="db00001400", server_name="cs-node-1", server_type="server", service_name="cs", state="old", topology_type="standalone"} 0 1659041397988
|