• EnglishEspañol日本語한국어Português
  • Log inStart now

Add, rename, or copy Prometheus attributes

The New Relic Prometheus OpenMetrics integration provides controls to transform the Prometheus metrics for Docker before sending them to New Relic. After you define the transformations in the integration config file, they are performed for all endpoints.

Hierarchy

The nri-prometheus-latest.yaml manifest file includes the nri-prometheus-cfg config map showing an example configuration. The transformations are executed in the following order:

  1. Ignore metrics.
  2. Add or include attributes.
  3. Rename attributes.
  4. Copy attributes.

Important

Avoid sending Prometheus OpenMetrics integration data that is not relevant to your monitoring needs. Instead, use filters to ignore or include specific metrics. This will help you control the amount and types of data you send to New Relic. This will also help you avoid additional billing charges. For more information, see Ignore or include Prometheus metrics.

Example configuration

To use these options, set up the scraper container configuration file (config.yaml in the current directory):

docker run -d --restart unless-stopped \
--name nri-prometheus \
-e CLUSTER_NAME="YOUR_CLUSTER_NAME"
-e LICENSE_KEY="YOUR_LICENSE_KEY" \
-v "$(pwd)/config.yaml:/config.yaml" \
newrelic/nri-prometheus:latest --configfile=/config.yaml

Here is an example configuration file containing all of these examples:

transformations:
- description: "Transformation for MySQL exporter"
add_attributes:
- metric_prefix: "mysql_"
attributes:
owningTeam: "database-team"
rename_attributes:
- metric_prefix: "mysql_"
attributes:
table: "tableName"
under_score: "CamelCase"
copy_attributes:
- from_metric: "mysql_version_info"
to_metrics:
- "mysql_"
attributes:
- "innodb_version"
- "version"
ignore_metrics:
- prefixes:
- "go_"
- "process_"

Add attributes

This transformation allows you to include a set of statically defined attributes to a set of target metrics.

Rename attributes

Not all Prometheus endpoints have consistent naming. You can rename the attributes as needed.

Copy attributes

Some Prometheus endpoints provide an _info or _static metric containing metadata about the service, such as the version. It can be helpful to have this attribute on all metrics for that service. This transformation allows you to copy attributes from a source metric to a set of target metrics.

Important

You can only copy attributes between metrics in the same endpoint.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.