The New Relic Prometheus OpenMetrics integration provides controls to transform the Prometheus metrics for Docker and Kubernetes 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:
- Ignore metrics.
- Add or include attributes.
- Rename attributes.
- 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.
For more help
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's and and documentation.