-
Notifications
You must be signed in to change notification settings - Fork 498
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
processor_labels: Add a documentation for processor_labels
Signed-off-by: Hiroshi Hatake <[email protected]>
- Loading branch information
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Labels | ||
|
||
The **labels** processor allows you to manipulate the labels of Metrics. | ||
|
||
Similar to the functionality exposed by filters, this processor presents a enriching/modifying mechanism to perform such operations for labels manipulation. | ||
The most significant difference is that processors perform better than filters, and when chaining them, there are no encoding/decoding performance penalties. | ||
|
||
Note that processors and this specific component can only be enabled using the new YAML configuration format. Classic mode configuration format doesn't support processors. | ||
|
||
## Configuration Parameters | ||
|
||
| Key | Description | | ||
| :---------- | :--- | | ||
| update | Update an existing key with a value into metrics. The key-value pair is required. | | ||
| insert | Insert a new key with a value into metrics. The key-value pair is required. | | ||
| upsert | Upsert a specific key with a value, the `upsert` operation will try to update the value of the key. If the key does not exist, the key will be created. The key-value pair is required. | | ||
| delete | Delete a key from the labels of metrics. The key-value pair is required. | | ||
| hash | Replace the key value with a hash generated by the SHA-1 algorithm from the specified label name, the binary value generated is finally set as an hex string representation. | | ||
|
||
|
||
#### Update example | ||
|
||
Change the value of the `name` to `fluentbit`: | ||
|
||
```yaml | ||
pipeline: | ||
inputs: | ||
- name: fluentbit_metrics | ||
processors: | ||
metrics: | ||
- name: labels | ||
update: name fluentbit | ||
outputs: | ||
- name : stdout | ||
match: '*' | ||
``` | ||
#### Insert example | ||
The following example appends the key `agent` with the value `fluentbit` as the label of metrics. | ||
|
||
```yaml | ||
pipeline: | ||
inputs: | ||
- name: fluentbit_metrics | ||
processors: | ||
metrics: | ||
- name: labels | ||
insert: agent fluentbit | ||
outputs: | ||
- name : stdout | ||
match: '*' | ||
``` | ||
|
||
#### Upsert example | ||
|
||
Delete containing `name` key from metrics: | ||
|
||
```yaml | ||
pipeline: | ||
inputs: | ||
- name: fluentbit_metrics | ||
processors: | ||
metrics: | ||
- name: labels | ||
delete: name | ||
outputs: | ||
- name : stdout | ||
match: '*' | ||
``` | ||
|
||
#### Delete example | ||
|
||
Update the value of `name` and insert `fluentbit`: | ||
|
||
```yaml | ||
pipeline: | ||
inputs: | ||
- name: fluentbit_metrics | ||
processors: | ||
metrics: | ||
- name: labels | ||
upsert: name fluentbit | ||
outputs: | ||
- name : stdout | ||
match: '*' | ||
``` | ||
|
||
#### Hash example | ||
|
||
Apply the SHA-1 algorithm for the value of the key `hostname`: | ||
|
||
```yaml | ||
pipeline: | ||
inputs: | ||
- name: fluentbit_metrics | ||
processors: | ||
metrics: | ||
- name: labels | ||
hash: hostname | ||
outputs: | ||
- name : stdout | ||
match: '*' | ||
``` |