pyroscope.relabel
Public preview: This is a public preview component. Public preview components are subject to breaking changes, and may be replaced with equivalent functionality that cover the same use case. The
stability.level
flag must be set topublic-preview
or below to use the component.
The pyroscope.relabel
component rewrites the label set of each profile passed to its receiver by applying one or more relabeling rules and forwards the results to the list of receivers.
If no rules are defined or applicable to some profiles, then those profiles are forwarded as-is to each receiver passed in the component’s arguments. The profile is dropped if no labels remain after the relabeling rules are applied.
The most common use of pyroscope.relabel
is to filter profiles or standardize the label set that is passed to one or more downstream receivers.
The rule
blocks are applied to the label set of each profile in order of their appearance in the configuration file.
Usage
pyroscope.relabel "<LABEL>" {
forward_to = <RECEIVER_LIST>
rule {
...
}
...
}
Arguments
You can use the following arguments with pyroscope.relabel
:
Blocks
You can use the following block with pyroscope.relabel
:
rule
The rule
block contains the definition of any relabeling rules that can be applied to an input metric.
If more than one rule
block is defined, the transformations are applied in top-down order.
The following arguments can be used to configure a rule
.
All arguments are optional. Omitted fields take their default values.
You can use the following actions:
drop
- Drops metrics whereregex
matches the string extracted using thesource_labels
andseparator
.dropequal
- Drop targets for which the concatenatedsource_labels
do matchtarget_label
.hashmod
- Hashes the concatenated labels, calculates its modulomodulus
and writes the result to thetarget_label
.keep
- Keeps metrics whereregex
matches the string extracted using thesource_labels
andseparator
.keepequal
- Drop targets for which the concatenatedsource_labels
don’t matchtarget_label
.labeldrop
- Matchesregex
against all label names. Any labels that match are removed from the metric’s label set.labelkeep
- Matchesregex
against all label names. Any labels that don’t match are removed from the metric’s label set.labelmap
- Matchesregex
against all label names. Any labels that match are renamed according to the contents of thereplacement
field.lowercase
- Setstarget_label
to the lowercase form of the concatenatedsource_labels
.replace
- Matchesregex
to the concatenated labels. If there’s a match, it replaces the content of thetarget_label
using the contents of thereplacement
field.uppercase
- Setstarget_label
to the uppercase form of the concatenatedsource_labels
.
Note
The regular expression capture groups can be referred to using either the
$CAPTURE_GROUP_NUMBER
or${CAPTURE_GROUP_NUMBER}
notation.
Exported fields
The following fields are exported and can be referenced by other components:
Component health
pyroscope.relabel
is reported as unhealthy if it is given an invalid configuration.
Debug metrics
pyroscope_relabel_cache_hits
(counter): Total number of cache hits.pyroscope_relabel_cache_misses
(counter): Total number of cache misses.pyroscope_relabel_cache_size
(gauge): Total size of relabel cache.pyroscope_relabel_profiles_dropped
(counter): Total number of profiles dropped by relabeling rules.pyroscope_relabel_profiles_processed
(counter): Total number of profiles processed.pyroscope_relabel_profiles_written
(counter): Total number of profiles forwarded.
Example
Compatible components
pyroscope.relabel
can accept arguments from the following components:
- Components that export Pyroscope
ProfilesReceiver
pyroscope.relabel
has exports that can be consumed by the following components:
- Components that consume Pyroscope
ProfilesReceiver
Note
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.