Skip to content
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

feat(processors.printer): Embed Influx serializer options #15434

Merged
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
19 changes: 19 additions & 0 deletions plugins/processors/printer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
```toml @sample.conf
# Print all metrics that pass through this filter.
[[processors.printer]]
## Maximum line length in bytes. Useful only for debugging.
# influx_max_line_bytes = 0

## When true, fields will be output in ascending lexical order. Enabling
## this option will result in decreased performance and is only recommended
## when you need predictable ordering while debugging.
# influx_sort_fields = false

## When true, Telegraf will output unsigned integers as unsigned values,
## i.e.: `42u`. You will need a version of InfluxDB supporting unsigned
## integer values. Enabling this option will result in field type errors if
## existing data has been written.
# influx_uint_support = false

## When true, Telegraf will omit the timestamp on data to allow InfluxDB
## to set the timestamp of the data during ingestion. This is generally NOT
## what you want as it can lead to data points captured at different times
## getting omitted due to similar data.
# influx_omit_timestamp = false
```

## Tags
Expand Down
9 changes: 2 additions & 7 deletions plugins/processors/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,16 @@ import (
var sampleConfig string

type Printer struct {
serializer *influx.Serializer
influx.Serializer
}

func (*Printer) SampleConfig() string {
return sampleConfig
}

func (p *Printer) Init() error {
p.serializer = &influx.Serializer{}
return p.serializer.Init()
}

func (p *Printer) Apply(in ...telegraf.Metric) []telegraf.Metric {
for _, metric := range in {
octets, err := p.serializer.Serialize(metric)
octets, err := p.Serialize(metric)
if err != nil {
continue
}
Expand Down
19 changes: 19 additions & 0 deletions plugins/processors/printer/sample.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# Print all metrics that pass through this filter.
[[processors.printer]]
## Maximum line length in bytes. Useful only for debugging.
# influx_max_line_bytes = 0

## When true, fields will be output in ascending lexical order. Enabling
## this option will result in decreased performance and is only recommended
## when you need predictable ordering while debugging.
# influx_sort_fields = false

## When true, Telegraf will output unsigned integers as unsigned values,
## i.e.: `42u`. You will need a version of InfluxDB supporting unsigned
## integer values. Enabling this option will result in field type errors if
## existing data has been written.
# influx_uint_support = false

## When true, Telegraf will omit the timestamp on data to allow InfluxDB
## to set the timestamp of the data during ingestion. This is generally NOT
## what you want as it can lead to data points captured at different times
## getting omitted due to similar data.
# influx_omit_timestamp = false
Loading