Update docs for addition of override processor

This commit is contained in:
Daniel Nelson 2018-03-07 13:47:54 -08:00
parent 82d224d9e2
commit d191ccdd3f
4 changed files with 31 additions and 22 deletions

View File

@ -35,6 +35,10 @@
- [ipset](./plugins/inputs/ipset/README.md) - Thanks to @sajoupa - [ipset](./plugins/inputs/ipset/README.md) - Thanks to @sajoupa
- [nats](./plugins/inputs/nats/README.md) - Thanks to @mjs & @levex - [nats](./plugins/inputs/nats/README.md) - Thanks to @mjs & @levex
### New Processors
- [override](./plugins/processors/override/README.md) - Thanks to @KarstenSchnitter
### New Parsers ### New Parsers
- [dropwizard](./docs/DATA_FORMATS_INPUT.md#dropwizard) - Thanks to @atzoum - [dropwizard](./docs/DATA_FORMATS_INPUT.md#dropwizard) - Thanks to @atzoum
@ -75,6 +79,7 @@
- [#3797](https://github.com/influxdata/telegraf/pull/3797): Add sum stat to basicstats aggregator. - [#3797](https://github.com/influxdata/telegraf/pull/3797): Add sum stat to basicstats aggregator.
- [#3626](https://github.com/influxdata/telegraf/pull/3626): Add ability to override proxy from environment in http response. - [#3626](https://github.com/influxdata/telegraf/pull/3626): Add ability to override proxy from environment in http response.
- [#3853](https://github.com/influxdata/telegraf/pull/3853): Add host to ping timeout log message. - [#3853](https://github.com/influxdata/telegraf/pull/3853): Add host to ping timeout log message.
- [#3773](https://github.com/influxdata/telegraf/pull/3773): Add override processor.
### Bugfixes ### Bugfixes

View File

@ -264,6 +264,7 @@ formats may be used with input plugins supporting the `data_format` option:
## Processor Plugins ## Processor Plugins
* [printer](./plugins/processors/printer) * [printer](./plugins/processors/printer)
* [override](./plugins/processors/override)
## Aggregator Plugins ## Aggregator Plugins

View File

@ -8,9 +8,14 @@ supported by input plugins and aggregators:
* name_suffix * name_suffix
* tags * tags
All metrics passing through this processor will be modified accordingly. Values All metrics passing through this processor will be modified accordingly.
of *name_override*, *name_prefix*, *name_suffix* and already present *tags* with Select the metrics to modify using the standard
conflicting keys will be overwritten. Absent *tags* will be created. [measurement filtering](https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md#measurement-filtering)
options.
Values of *name_override*, *name_prefix*, *name_suffix* and already present
*tags* with conflicting keys will be overwritten. Absent *tags* will be
created.
Use-case of this plugin encompass ensuring certain tags or naming conventions Use-case of this plugin encompass ensuring certain tags or naming conventions
are adhered to irrespective of input plugin configurations, e.g. by are adhered to irrespective of input plugin configurations, e.g. by
@ -19,12 +24,14 @@ are adhered to irrespective of input plugin configurations, e.g. by
### Configuration: ### Configuration:
```toml ```toml
# Add a global tag to all metrics # Apply metric modifications using override semantics.
[[processors.override]] [[processors.override]]
name_override = "new name_override" ## All modifications on inputs and aggregators can be overridden:
name_prefix = "new name_prefix" # name_override = "new_name"
name_suffix = ":new name_suffix" # name_prefix = "new_name_prefix"
[processors.tags.add] # name_suffix = "new_name_suffix"
additional_tag = "tag_value"
existing_tag = "new tag_value" ## Tags to be added (all values must be strings)
# [processors.override.tags]
# additional_tag = "tag_value"
``` ```

View File

@ -6,18 +6,14 @@ import (
) )
var sampleConfig = ` var sampleConfig = `
## NOTE This processor will override names, name prefixes, name suffixes and ## All modifications on inputs and aggregators can be overridden:
## values of tags, that are already present in the metric passed through this # name_override = "new_name"
## filter. # name_prefix = "new_name_prefix"
# name_suffix = "new_name_suffix"
## All modifications on inputs and aggregators can be overridden: ## Tags to be added (all values must be strings)
# name_override = "new name" # [processors.override.tags]
# name_prefix = "new name_prefix" # additional_tag = "tag_value"
# name_suffix = "new name_suffix"
## Tags to be added (all values must be strings)
# [processors.overide.tags]
# additional_tag = "tag_value"
` `
type Override struct { type Override struct {
@ -32,7 +28,7 @@ func (p *Override) SampleConfig() string {
} }
func (p *Override) Description() string { func (p *Override) Description() string {
return "Add all configured tags to all metrics that pass through this filter." return "Apply metric modifications using override semantics."
} }
func (p *Override) Apply(in ...telegraf.Metric) []telegraf.Metric { func (p *Override) Apply(in ...telegraf.Metric) []telegraf.Metric {