New Relic Latest

Scale applications based on New Relic NRQL

Availability: 2.6+ Maintainer: Community

Trigger Specification

This specification describes the new-relic trigger that scales based on a New Relic metric.

triggers:
  - type: new-relic
    metadata:
      # Required: Account - Subaccount to run the query on
      account: 1234567
      # Required: QueryKey - Api key to connect to New Relic
      queryKey: "NRAK-xxxxxxxxxxxxxxxxxxxxxxxxxxx"
      # Optional: nrRegion - Region to query data for. Default value is US.
      region: "US"
      # Optional: noDataError - If the query returns no data should this be treated as an error. Default value is false.
      noDataError: "true"
      # Required: nrql
      nrql: "SELECT average(duration) from Transaction where appName='SITE' TIMESERIES"
      # Required: threshold
      threshold: 100

Parameter list:

  • account - The account within New Relic that the request should be targeted against.
  • queryKey - The API key that will be leveraged to connect to New Relic and make requests. official documentation
  • region - The region to connect to for the New Relic apis. (Values: LOCAL, EU, STAGING, US, Default: US, Optional)
  • noDataError - Should queries that return nodata be treated as an error (Values: true, false, Default: false, Optional)
  • nrql - The New Relic query that will be run to get the data requested. official documentation
  • threshold - A threshold that is used as the targetValue or targetAverageValue (depending on the trigger metric type) in the HPA configuration.

Authentication Parameters

You can use TriggerAuthentication CRD to configure the authentication with a queryKey.

Authentication:

  • queryKey - The API key that will be leveraged to connect to New Relic and make requests. official documentation

  • account - The account within New Relic that the request should be targeted against. This can be used to replace the value that would be provided in the trigger.

  • region - The region to connect to for the New Relic apis. This can be used to replace the value that would be provided in the trigger.

Example

apiVersion: v1
kind: Secret
metadata:
  name: new-relic-secret
  namespace: my-project
type: Opaque
data:
  apiKey: TlJBSy0xMjM0NTY3ODkwMTIzNDU2Nwo= # base64 encoding of the new relic api key NRAK-12345678901234567
  account: MTIzNDU2 # base64 encoding of the new relic account number 123456
  region: VVM= # base64 encoding of the new relic region US
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: keda-trigger-auth-new-relic
  namespace: my-project
spec:
  secretTargetRef:
  - parameter: queryKey
    name: new-relic-secret
    key: apiKey
  - parameter: account
    name: new-relic-secret
    key: account
  - parameter: region
    name: new-relic-secret
    key: region

---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: newrelic-scaledobject
  namespace: keda
spec:
  maxReplicaCount: 12
  scaleTargetRef:
    name: dummy
  triggers:
    - type: new-relic
      metadata:
        nrql: "SELECT average(duration) from Transaction where appName='SITE' TIMESERIES"
        noDataError: "true"
        threshold: 1000
      authenticationRef:
        name: keda-trigger-auth-new-relic


Currently available scalers for KEDA