Skip to content

Commit

Permalink
fix(inputs.bind): Convert counters to uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan committed Oct 14, 2024
1 parent 4e6e2a2 commit 5c11819
Show file tree
Hide file tree
Showing 6 changed files with 1,333 additions and 24 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<!-- markdownlint-disable MD024 -->
# Changelog

## Unreleased

### Important Changes

- PR [#16015](https://github.com/influxdata/telegraf/pull/16015) changes the internal
counters of the Bind plugin to unsigned integers matching the server
implementation. We keep backward compatibility by setting
`report_counters_as_int` to `true` by default to avoid type conflicts on the
output side. However, you should change this setting to `false` as soon as
possible to avoid invalid values and parsing errors with the v3 XML statistics.

## v1.32.1 [2024-10-07]

### Important Changes
Expand Down
5 changes: 5 additions & 0 deletions plugins/inputs/bind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
# gather_memory_contexts = false
# gather_views = false

## Report xml v3 counters as integers instead of unsigned for backward
## compatibility. Set this to false as soon as possible!
## Values are clipped if exceeding the integer range.
# report_counters_as_int = true

## Timeout for http requests made by bind nameserver
# timeout = "4s"
```
Expand Down
9 changes: 5 additions & 4 deletions plugins/inputs/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import (
var sampleConfig string

type Bind struct {
Urls []string
GatherMemoryContexts bool
GatherViews bool
Urls []string `tom:"urls"`
GatherMemoryContexts bool `tom:"gather_memory_contexts"`
GatherViews bool `tom:"gather_views"`
Timeout config.Duration `toml:"timeout"`
CountersAsInt bool `toml:"report_counters_as_int"`

client http.Client
}
Expand Down Expand Up @@ -84,5 +85,5 @@ func (b *Bind) gatherURL(addr *url.URL, acc telegraf.Accumulator) error {
}

func init() {
inputs.Add("bind", func() telegraf.Input { return &Bind{} })
inputs.Add("bind", func() telegraf.Input { return &Bind{CountersAsInt: true} })
}
Loading

0 comments on commit 5c11819

Please sign in to comment.