Skip to content

NewRelic Metrics

Important

Available since v0.10.0

A New Relic query using NRQL can be used to obtain measurements for analysis.

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: success-rate
spec:
  args:
  - name: application-name
  metrics:
  - name: success-rate
    successCondition: result.successRate >= 0.95
    provider:
      newRelic:
        profile: my-newrelic-secret  # optional, defaults to 'newrelic'
        query: |
          FROM Transaction SELECT percentage(count(*), WHERE httpResponseCode != 500) as successRate where appName = '{{ args.application-name }}'
        timeout: 10 # NRQL query timeout in seconds. Optional, defaults to 5

The result evaluated for the condition will always be map or list of maps. The name will follow the pattern of either function or function.field, e.g. SELECT average(duration) from Transaction will yield average.duration. In this case the field result cannot be accessed with dot notation and instead should be accessed like result['average.duration']. Query results can be renamed using the NRQL clause AS as seen above.

A New Relic access profile can be configured using a Kubernetes secret in the argo-rollouts namespace. Alternate accounts can be used by creating more secrets of the same format and specifying which secret to use in the metric provider configuration using the profile field.

apiVersion: v1
kind: Secret
metadata:
  name: newrelic
type: Opaque
stringData:
  personal-api-key: <newrelic-personal-api-key>
  account-id: <newrelic-account-id>
  region: "us" # optional, defaults to "us" if not set. Only set to "eu" if you use EU New Relic

To use the New Relic metric provider from behind a proxy, provide a base-url-rest key pointing to the base URL of the New Relic REST API for your proxy, and a base-url-nerdgraph key pointing to the base URL for NerdGraph for your proxy:

apiVersion: v1
kind: Secret
metadata:
  name: newrelic
type: Opaque
stringData:
  personal-api-key: <newrelic-personal-api-key>
  account-id: <newrelic-account-id>
  region: "us" # optional, defaults to "us" if not set. Only set to "eu" if you use EU New Relic
  base-url-rest: <your-base-url>
  base-url-nerdgraph: <your-base-url>

Additional Metadata

The New Relic provider returns the below metadata under the Metadata map in the MetricsResult object of AnalysisRun.

KEY Description
ResolvedNewRelicQuery Resolved query after substituting the template's arguments