No results for

Powered byAlgolia

Prometheus Remote Write

suggest edits

Configuration Parameters

The configuration parameters for sending metrics to Prometheus are as follows:

NameDescription
providerAny APM provider name available in the supported APM provider's table.
remoteWriteURLThe remoteWriteURL provided by your Prometheus Remote Write provider or the URL of your own self-hosted Prometheus instance, for example: http://monitoring.example.com:9090/api/v1/write.
credentialsThe credentials provided by your Prometheus Remote Write provider. Currently only bearer token and HTTP basic authentication mechanism are supported, as listed below. This field is optional.
metricsList of built-in and custom metrics to be exported. Metric names will be validated against the Prometheus metric name conventions and non-conforming metrics will be ignored.
includeDefaultMetricsIf set, the export will include the default metrics. Default is true.
resampleRateThe rate by which the metrics are resampled and sent to the APM provider in seconds. Default is 3 and acceptable values are integers between 1 and 10.
includeTestRunIdIf set, the test_run_id will be exported per each metric as an extra tag. Default is false.

Supported Authentication Mechanisms

Currently only bearer token and HTTP basic authentication mechanisms are supported. To configure your authentication mechanism, populate credentials with either of these configuration parameters:

HTTP basic authentication

NameDescription
usernameThe username in HTTP basic authentication.
passwordThe password in HTTP basic authentication.
credentials: {
username: "<username>",
password: "<password>"
}

Bearer token authentication

NameDescription
tokenThe bearer token without the prefix/type.
credentials: {
token: "<token>"
}

Example Configuration Object

All the above configuration parameters are passed like this in your test run.

export let options = {
ext: {
loadimpact: {
apm: [
{
provider: "prometheus",
remoteWriteURL: "<Remote Write URL>", // This can include query-string parameters
credentials: {
token: "<token>" // Optional
},
metrics: ["http_req_sending", "my_rate", "my_gauge", ...],
includeDefaultMetrics: true,
includeTestRunId: false
},
]
},
},
};

New Relic Setup

For sending custom metrics from your test run to New Relic's Prometheus remote write integration, follow the instructions on their documentation.

The prometheus_server parameter should be included in the remoteWriteURL configuration parameter. The bearer token can be included either as credentials.token (APM configuration parameter) or as part of the remoteWriteURL using the X-License-Key parameter, as mentioned in their documentation.

So an example configuration for New Relic might look like this, with X-License-Key used as token in credentials would be:

export let options = {
ext: {
loadimpact: {
apm: [
{
provider: "prometheus",
remoteWriteURL: "https://metric-api.newrelic.com/prometheus/v1/write?prometheus_server=<YOUR_DATA_SOURCE_NAME>",
credentials: {
token: "<YOUR_LICENSE_KEY>"
},
metrics: ["http_req_sending", "my_rate", "my_gauge", ...],
includeDefaultMetrics: true,
includeTestRunId: false
},
]
},
},
};

Grafana Cloud Setup

For sending custom metrics from your test run to Grafana Cloud's Prometheus remote write integration, follow the instructions on their documentation.

As also mentioned in their documentation, you can find the remoteWriteURL, username and password for your metrics endpoint by clicking on Details in the Prometheus card of the Grafana Cloud Portal. When you are creating an API key on Grafana Cloud Portal to be used as password, make sure to use MetricsPublisher as role.

An example configuration for Grafana Cloud might look like this:

export let options = {
ext: {
loadimpact: {
apm: [
{
provider: "prometheus",
remoteWriteURL: "https://prometheus-us-central1.grafana.net/api/prom/push",
credentials: {
username: "<Your Metrics instance ID>",
password: "<Your Grafana.com API Key>"
},
metrics: ["http_req_sending", "my_rate", "my_gauge", ...],
includeDefaultMetrics: true,
includeTestRunId: false
},
]
},
},
};

Grafana Cloud metrics explorer