How to filter metrics by label?

Streamlining Metric Analysis for Faster Insights

How to filter metrics by label?

It is sometimes easy to get lost in the mountain of metrics and infinite number of dimensions when working with an infrastructure monitoring tool. Being able to filter metrics by label and visualize only what is relevant to the current scope of monitoring &troubleshooting, becomes absolutely crucial to the success of SREs, Sysadmins and DevOps professionals.

The Netdata chart label filtering feature supports grouping by and filtering each chart based on labels (key/value pairs) applicable to the context and provides fine-grain capability on slicing the data / metrics.

All metrics collected get “tagged” with labels and values, thus providing a powerful way to filter metrics by label and visualize all metrics related to the infrastructure.

The chart label filtering is now enabled on:

  • All charts on the Overview tab.
  • Custom dashboards.

filter metrics by label

filter metrics by label

The top panel on each chart displays the various filters and grouping options selected on the specific chart. These filters are specific for each chart and need to be manually configured on each chart.

Additionally, the charts can be saved to a custom dashboard (new or existing) with the selected filters from the overview screen.

filter metrics by label

Customizing labels for Collectors

In addition to the default labels associated with a collector and metrics context (you can identify them by seeing which ones have an ‘_’ as a prefix), there is now a new feature enabled to create custom labels. These custom labels may be needed to group your jobs / instances into various categories.

These custom labels can be configured within your go.d plugins by simply associating a label key / value pair.

jobs:
  - name: example_1
    someOption: someValue
    labels:
      label1: value1
      label2: value2

  - name: example_2
    someOption: someValue
    labels:
      label3: value3
      label4: value4

For instance, within an infrastructure you may be running multiple Postgres database instances. Some of these may be associated with testing environments, some with staging and some with production environments. You can now associate each Postgres job / instance with a custom label. The “group by” and filtering options will then allow you to associate individual jobs by specific labels.

jobs:
  - name: local
    dsn: 'postgres://postgres:postgres@127.0.0.1:5432/postgres'
    collect_databases_matching: '*'
    labels:
      instance_type: production

custom labels for collectors

custom labels for collectors

What’s Next?

If you haven’t already, sign up now for a free Netdata account!

We’d love to hear from you – if you have any questions, complaints or feedback please reach out to us on Discord or Github.

Happy Troubleshooting!

Discover More