Skip to content

Commit 32989ec

Browse files
Merge pull request #1621 from fluent/alexakreizinger/sc-128556/customer-complained-about-misleading-documentation
2 parents 651f825 + fee870f commit 32989ec

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

pipeline/processors/metrics-selector.md

+32-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,45 @@
11
# Metrics Selector
22

3-
The **metric_selector** processor allows you to select metrics to include or exclude (similar to the `grep` filter for logs).
3+
The _Metrics Selector_ processor lets you choose which metrics to include or exclude, similar to the [Grep](../pipeline/filters/grep) filter for logs.
44

55
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=326269f3-cfea-472d-9169-1de32c142b90" />
66

7-
## Configuration Parameters <a id="config"></a>
7+
## Configuration parameters
88

9-
The native processor plugin supports the following configuration parameters:
9+
The Metrics Selector processor supports the following configuration parameters:
1010

1111
| Key | Description | Default |
1212
| :---------- | :--- | :--- |
13-
| Metric\_Name | Keep metrics in which the metric of name matches with the actual name or the regular expression. | |
14-
| Context | Specify matching context. Currently, metric\_name and delete\_label\_value are only supported. | `Metrics_Name` |
15-
| Action | Specify the action for specified metrics. INCLUDE and EXCLUDE are allowed. | |
16-
| Operation\_Type | Specify the operation type of action for metrics payloads. PREFIX and SUBSTRING are allowed. | |
17-
| Label | Specify a label key and value pair. | |
13+
| `metric_name` | The string that determines which metrics are affected by this processor, depending on the active [matching operation](#matching-operations). | |
14+
| `context` | Specifies matching context. Possible values: `metric_name` or `delete_label`. | `metrics_name` |
15+
| `action` | Specifies whether to include or exclude matching metrics. Possible values: `INCLUDE` or `EXCLUDE`. | |
16+
| `operation_type` | Specifies the [matching operation](#matching-operations) to apply to the value of `metric_name`. Possible values: `PREFIX` or `SUBSTRING`. | |
17+
| `label` | Specifies a label key and value pair. | |
1818

19-
## Configuration Examples <a id="config_example"></a>
19+
## Matching operations
2020

21-
Here is a basic configuration example.
21+
The Metrics Selector processor has two matching operations: prefix matching and substring matching.
22+
23+
### Prefix matching
24+
25+
Prefix matching compares the value of `metric_name` to the beginning of each incoming metric name. For example, `metric_name: fluentbit_input` results in a match for metrics named `fluentbit_input_records`, but not for metrics named `total_fluentbit_input`.
26+
27+
If no `operation_type` value is specified and the value of `metric_name` is a standard string, the Metrics Selector processor defaults to prefix matching.
28+
29+
### Substring matching
30+
31+
Substring matching treats the value of `metric_name` as a regex pattern, and compares this pattern against each incoming metric name accordingly. This pattern can appear anywhere within the name of the incoming metric. For example, `metric_name: bytes` results in a match for metrics named `bytes_total` and metrics named `input_bytes_count`.
32+
33+
If the value of `metric_name` is a string wrapped in forward slashes (for example, `metric_name: /storage..*/`), the Metrics Selector processor defaults to substring matching, regardless of whether an `operation_type` value is specified. This means that a `metric_name` value wrapped in forward slashes will always use substring matching, even if `operation_type` is set to `PREFIX`.
34+
35+
However, if `operation_type` is explicitly set to `SUBSTRING`, you don't need to wrap the value of `metric_name` in forward slashes.
36+
37+
## Configuration examples
38+
39+
The following examples show possible configurations of the Metrics Selector processor.
40+
41+
### Without `context`
2242

23-
{% tabs %}
24-
{% tab title="fluent-bit.yaml" %}
2543
```yaml
2644
service:
2745
flush: 5
@@ -51,9 +69,9 @@ pipeline:
5169
- name: stdout
5270
match: '*'
5371
```
54-
{% endtab %}
5572
56-
{% tab title="context-delete\_label\_value.yaml" %}
73+
### With `context`
74+
5775
```yaml
5876
service:
5977
flush: 5
@@ -80,14 +98,3 @@ pipeline:
8098
- name: stdout
8199
match: '*'
82100
```
83-
{% endtab %}
84-
{% endtabs %}
85-
86-
87-
All processors are only valid with the YAML configuration format.
88-
Processor configuration should be located under the relevant input or output plugin configuration.
89-
90-
Metric\_Name parameter will translate the strings which is quoted with backslashes `/.../` as Regular expressions.
91-
Without them, users need to specify Operation\_Type whether prefix matching or substring matching.
92-
The default operation is prefix matching.
93-
For example, `/chunks/` will be translated as a regular expression.

0 commit comments

Comments
 (0)