• Log inStart now

Data governance

Change the scrape interval

The Kubernetes Integration v3 and above allows changing the interval at which metrics are gathered from the cluster. This allows choosing a tradeoff between data resolution and usage. We recommend choosing an interval between 15 and 30 seconds for optimal experience.

In order to change the scrape interval, add the following to your values-newrelic.yaml, under the newrelic-infrastructure section:

common:
config:
interval: 25s

So it ends up looking like:

global:
licenseKey: _YOUR_NEW_RELIC_LICENSE_KEY_
cluster: _K8S_CLUSTER_NAME_
# ... Other settings as shown above
# Configuration for newrelic-infrastructure
newrelic-infrastructure:
# ... Other settings as shown above
common:
config:
interval: 25s

Important

Setting interval to values larger than 40s is not allowed.

Filtering Namespaces

The Kubernetes Integration v3 and above allows filtering which namespaces are scraped by labelling them. By default all namespaces are scraped.

We use the namespaceSelector in the same way Kubernetes does. In order to include only namespaces matching a label, change the namespaceSelector by adding the following to your values-newrelic.yaml, under the newrelic-infrastructure section:

common:
config:
namespaceSelector:
matchLabels:
key1 : "value1"

In this example only namespaces with the label newrelic.com/scrape set to true will be scraped:

global:
licenseKey: _YOUR_NEW_RELIC_LICENSE_KEY_
cluster: _K8S_CLUSTER_NAME_
# ... Other settings as shown above
# Configuration for newrelic-infrastructure
newrelic-infrastructure:
# ... Other settings as shown above
common:
config:
namespaceSelector:
matchLabels:
newrelic.com/scrape: "true"

You can also use Kubernetes expressions to include or exclude namespaces using the following syntax:

common:
config:
namespaceSelector:
matchExpressions:
- {key: newrelic.com/scrape, operator: NotIn, values: ["false"]}
- {key: key1, operator: In, values: ["value1"]}

Tip

The expressions under matchExpressions are concatenated.

In this example namespaces with the label newrelic.com/scrape set to false will be excluded:

global:
licenseKey: _YOUR_NEW_RELIC_LICENSE_KEY_
cluster: _K8S_CLUSTER_NAME_
# ... Other settings as shown above
# Configuration for newrelic-infrastructure
newrelic-infrastructure:
# ... Other settings as shown above
common:
config:
namespaceSelector:
matchExpressions:
- {key: newrelic.com/scrape, operator: NotIn, values: ["false"]}

See a full list of the settings that can be modified in the chart's README file.

How can I know which namespaces are excluded?

All the namespaces within the cluster are listed thanks to the K8sNamespace sample. The nrFiltered attribute determines whether the data related to the namespace is going to be scraped.

Use this query to know which namespaces are being monitored:

FROM K8sNamespaceSample SELECT displayName, nrFiltered WHERE clusterName = <clusterName> SINCE 2 MINUTES AGO

What data is being discarded from the excluded namespaces?

The following samples won't be available for the excluded namespaces:

  • K8sContainerSample
  • K8sDaemonsetSample
  • K8sDeploymentSample
  • K8sEndpointSample
  • K8sHpaSample
  • K8sPodSample
  • K8sReplicasetSample
  • K8sServiceSample
  • K8sStatefulsetSample
  • K8sVolumeSample
Copyright © 2022 New Relic Inc.

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