Skip to main content

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 DataQuerying role preset, or the Query Metrics permission metrics.data-api#high:ReadData. A Legacy Logs Query API Key also 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

1.
Add the data source

In Grafana, select Home, then Connections, then Add new connection. Search for Prometheus, then select Add new data source.

2.
Configure the connection

Set Prometheus server URL to the metrics endpoint for your Coralogix domain.

3.
Configure authentication

Under HTTP headers, add a header named Authorization with the value Bearer <API-Key>.

4.
Set the Prometheus version

Under Advanced settings, then Performance, set Prometheus type to Prometheus and Prometheus version to 2.24.x.

5.
Save and test

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.

EndpointPurpose
/api/v1/queryInstant query
/api/v1/query_rangeRange query
/api/v1/label/<label_name>/valuesQuery label values
/api/v1/labelsGet label names
/api/v1/seriesFind series by label matchers

Unsupported endpoints

These Prometheus endpoints are not available on the Coralogix Metrics API.

EndpointPurpose
/api/v1/alertsList active alerts
/api/v1/query_exemplarsQuery exemplars for a series over time
/api/v1/rulesList alerting and recording rules
/api/v1/targets/metadataReturn metadata about metrics from targets
Last updated on
On this page
Was this page helpful?