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.
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.
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.
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_"
This transformation allows you to include a set of statically defined attributes to a set of target metrics.
Not all Prometheus endpoints have consistent naming. You can rename the attributes as needed.
Some Prometheus endpoints provide an
_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.
You can only copy attributes between metrics in the same endpoint.