Metrics API
The Metrics API gives you access to every metric you have sent to Coralogix through a Prometheus-compatible interface. That means two things in practice: you can query metrics programmatically with curl or any HTTP client, and you can point a Grafana Prometheus data source straight at it.
What you need
- A custom API key with the
DataQueryingrole preset, or theQuery Metricspermissionmetrics.data-api#high:ReadData. ALegacy Logs Query API Keyalso works. - The metrics endpoint for your Coralogix domain. Use the domain selector at the top of this page to resolve it: https://api./metrics
Every request carries the key in an Authorization header:
Authorization: Bearer <API-Key>
Query metrics programmatically
An instant query evaluates an expression at a single point in time:
curl --location --request GET 'https://api.eu2.coralogix.com/metrics/api/v1/query?query=vector(1)' --header 'Authorization: Bearer <API-Key>'
Substitute the endpoint for your domain and your own API key.
Use it as a Grafana data source
In Grafana, select Home, then Connections, then Add new connection. Search for Prometheus, then select Add new data source.
Set Prometheus server URL to the metrics endpoint for your Coralogix domain.
Under HTTP headers, add a header named Authorization with the value Bearer <API-Key>.
Under Advanced settings, then Performance, set Prometheus type to Prometheus and Prometheus version to 2.24.x.
Select Save & test. A successful query to the Prometheus API confirms the data source works.
Grafana's own Prometheus data source documentation covers the remaining options.
Supported endpoints
Available for both GET and POST. See the Prometheus HTTP API reference for their parameters.
| Endpoint | Purpose |
|---|---|
/api/v1/query | Instant query |
/api/v1/query_range | Range query |
/api/v1/label/<label_name>/values | Query label values |
/api/v1/labels | Get label names |
/api/v1/series | Find series by label matchers |
Unsupported endpoints
These Prometheus endpoints are not available on the Coralogix Metrics API.
| Endpoint | Purpose |
|---|---|
/api/v1/alerts | List active alerts |
/api/v1/query_exemplars | Query exemplars for a series over time |
/api/v1/rules | List alerting and recording rules |
/api/v1/targets/metadata | Return metadata about metrics from targets |