Skip to content

processor_metrics_selector: Add documents for metrics_selector processor #1340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ redirects:
output/stdout: ./pipeline/outputs/standard-output.md
output/tcp: ./pipeline/outputs/tcp-and-tls.md
output/td: ./pipeline/outputs/treasure-data.md

# Processors
processor/metrics_selector: ./pipeline/processors/metrics_selector.md
2 changes: 2 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@
* [Treasure Data](pipeline/outputs/treasure-data.md)
* [Vivo Exporter](pipeline/outputs/vivo-exporter.md)
* [WebSocket](pipeline/outputs/websocket.md)
* [Processors](pipeline/processors/README.md)
* [Metrics Selector](pipeline/processors/metrics-selector.md)

## Stream Processing

Expand Down
8 changes: 8 additions & 0 deletions installation/sources/build-and-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,11 @@ The _output plugins_ gives the capacity to flush the information to some externa
| FLB\_OUT\_TCP | Enable TCP/TLS output plugin | On |
| [FLB\_OUT\_TD](../../pipeline/outputs/treasure-data.md) | Enable [Treasure Data](http://www.treasuredata.com) output plugin | On |

### Processor Plugins

The _processor plugins_ provide the capability to handle the events within the processor pipelines to allow modifying, enrich or drop events.
The following table describes the processors available on this version:

| option | description | default |
| :--- | :--- | :--- |
| [FLB\_PROCESSOR\_METRICS\_SELECTOR](../../pipeline/processors/metrics-selector.md) | Enable metrics selector processor | On |
2 changes: 2 additions & 0 deletions pipeline/processors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Processors

61 changes: 61 additions & 0 deletions pipeline/processors/metrics-selector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Metrics Selector

The **metric_selector** processor allows you to select metrics to include or exclude (similar to the `grep` filter for logs).

## Configuration Parameters <a id="config"></a>

The native processor plugin supports the following configuration parameters:

| Key | Description | Default |
| :---------- | :--- | :--- |
| Metric\_Name | Keep metrics in which the metric of name matches with the actual name or the regular expression. | |
| Context | Specify matching context. Currently, metric_name is only supported. | `Metrics_Name` |
| Action | Specify the action for specified metrics. INCLUDE and EXCLUDE are allowed. | |
| Operation\_Type | Specify the operation type of action for metrics payloads. PREFIX and SUBSTRING are allowed. | |

## Configuration Examples <a id="config_example"></a>

Here is a basic configuration example.

{% tabs %}
{% tab title="fluent-bit.yaml" %}
```yaml
service:
flush: 5
daemon: off
log_level: info

pipeline:
inputs:
- name: fluentbit_metrics
tag: fluentbit.metrics
scrape_interval: 10

processors:
metrics:
- name: metrics_selector
metric_name: /storage/
action: include
- name: metrics_selector
metric_name: /fs/
action: exclude

- name: labels
delete: name


outputs:
- name: stdout
match: '*'
```
{% endtab %}
{% endtabs %}


All processors are only valid with the YAML configuration format.
Processor configuration should be located under the relevant input or output plugin configuration.

Metric\_Name parameter will translate the strings which is quoted with backslashes `/.../` as Regular expressions.
Without them, users need to specify Operation\_Type whether prefix matching or substring matching.
The default operation is prefix matching.
For example, `/chunks/` will be translated as a regular expression.