Skip to content

Commit

Permalink
Merge branch 'master' of github.com:influxdata/telegraf
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy.krapivenko committed Jan 18, 2025
2 parents 72efe2e + 4905e9f commit fde91fd
Show file tree
Hide file tree
Showing 223 changed files with 4,289 additions and 3,851 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
- run: 'make check-deps'
- run:
name: "Install golangci-lint"
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
- run:
name: "golangci-lint/Linux"
# There are only 4 vCPUs available for this executor, so use only 4 instead of the default number
Expand All @@ -120,7 +120,7 @@ jobs:
- check-changed-files-or-halt
- run:
name: "Install golangci-lint"
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
- run:
name: "golangci-lint/macOS"
# There are only 4 vCPUs available for this executor, so use only 4 instead of the default number
Expand All @@ -134,7 +134,7 @@ jobs:
- check-changed-files-or-halt
- run:
name: "Install golangci-lint"
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
- run:
name: "golangci-lint/Windows"
# There are only 4 vCPUs available for this executor, so use only 4 instead of the default number
Expand Down
79 changes: 41 additions & 38 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ linters-settings:
# Default: false
disable-all: true
# Which checks should be enabled in addition to default checks; can't be combined with 'disabled-checks'.
# By default, list of stable checks is used (https://go-critic.github.io/overview#checks-overview).
# By default, list of stable checks is used (https://go-critic.com/overview#checks-overview).
# To see which checks are enabled run `GL_DEBUG=gocritic golangci-lint run --enable=gocritic`.
enabled-checks:
# diagnostic
Expand Down Expand Up @@ -143,7 +143,7 @@ linters-settings:

# Settings passed to gocritic.
# The settings key is the name of a supported gocritic checker.
# The list of supported checkers can be find in https://go-critic.github.io/overview.
# The list of supported checkers can be find in https://go-critic.com/overview.
settings:
hugeParam:
# Size in bytes that makes the warning trigger.
Expand All @@ -159,38 +159,38 @@ linters-settings:
# Available rules: https://github.com/securego/gosec#available-rules
# Default: [] - means include all rules
includes:
- G101
- G102
- G103
- G106
- G107
- G108
- G109
- G110
- G111
- G112
- G114
- G201
- G202
- G203
- G301
- G302
- G303
- G305
- G306
- G401
- G403
- G404
- G405
- G406
- G501
- G502
- G503
- G505
- G506
- G507
- G601
- G602
- G101 # Look for hard coded credentials
- G102 # Bind to all interfaces
- G103 # Audit the use of unsafe block
- G106 # Audit the use of ssh.InsecureIgnoreHostKey
- G107 # Url provided to HTTP request as taint input
- G108 # Profiling endpoint automatically exposed on /debug/pprof
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
- G110 # Potential DoS vulnerability via decompression bomb
- G111 # Potential directory traversal
- G112 # Potential slowloris attack
- G114 # Use of net/http serve function that has no support for setting timeouts
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
- G301 # Poor file permissions used when creating a directory
- G302 # Poor file permissions used with chmod
- G303 # Creating tempfile using a predictable path
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G401 # Detect the usage of MD5 or SHA1
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G405 # Detect the usage of DES or RC4
- G406 # Detect the usage of MD4 or RIPEMD160
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G505 # Import blocklist: crypto/sha1
- G506 # Import blocklist: golang.org/x/crypto/md4
- G507 # Import blocklist: golang.org/x/crypto/ripemd160
- G601 # Implicit memory aliasing of items from a range statement
- G602 # Slice access out of bounds
# G104, G105, G113, G204, G304, G307, G402, G504 were not enabled intentionally
# TODO: review G115 when reporting false positives is fixed (https://github.com/securego/gosec/issues/1212)
# To specify the configuration of rules.
Expand Down Expand Up @@ -318,6 +318,7 @@ linters-settings:
- name: unnecessary-stmt
- name: unreachable-code
- name: unused-parameter
- name: unused-receiver
- name: var-declaration
- name: var-naming
- name: waitgroup-by-value
Expand Down Expand Up @@ -432,6 +433,10 @@ issues:
# Default: 3
max-same-issues: 0

# Make issues output unique by line.
# Default: true
uniq-by-line: false

# output configuration options
output:
# The formats used to render issues.
Expand Down Expand Up @@ -464,10 +469,6 @@ output:
- format: tab
path: stdout

# Make issues output unique by line.
# Default: true
uniq-by-line: false

# Sort results by the order defined in `sort-order`.
# Default: false
sort-results: true
Expand All @@ -476,7 +477,9 @@ output:
# Default: false
show-stats: true

# Options for analysis running.
run:
# Timeout for analysis, e.g. 30s, 5m.
# If the value is lower or equal to 0, the timeout is disabled.
# Default: 1m
timeout: 10m
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,48 @@

### Important Changes

- PR [#16403](https://github.com/influxdata/telegraf/pull/16403) ensures consistency of the NetFlow plugin's
`ip_version` field type by enforcing "IPv4", "IPv6", or "unknown" string values. Previously the `ip_version` could
become an (unsigned) integer when parsing raw-packets' headers especially with SFlow v5 input. Please watch
out for type-conflicts on the output side!

## v1.33.1 [2025-01-10]

### Important Changes

- The default value of `skip_processors_after_aggregators` will change to `true`
with Telegraf `v1.40.0`, skip running the processors again after aggregators!
If you need the current default behavior, please explicitly set the option to
`false`! To silence the warning and use the future default behavior, please
explicitly set the option to `true`.

### Bugfixes

- [#16290](https://github.com/influxdata/telegraf/pull/16290) `agent` Skip initialization of second processor state if requested
- [#16377](https://github.com/influxdata/telegraf/pull/16377) `inputs.intel_powerstat` Fix option removal version
- [#16310](https://github.com/influxdata/telegraf/pull/16310) `inputs.mongodb` Do not dereference nil pointer if gathering database stats fails
- [#16383](https://github.com/influxdata/telegraf/pull/16383) `outputs.influxdb_v2` Allow overriding auth and agent headers
- [#16388](https://github.com/influxdata/telegraf/pull/16388) `outputs.influxdb_v2` Fix panic and API error handling
- [#16289](https://github.com/influxdata/telegraf/pull/16289) `outputs.remotefile` Handle tracking metrics correctly

### Dependency Updates

- [#16344](https://github.com/influxdata/telegraf/pull/16344) `deps` Bump cloud.google.com/go/bigquery from 1.64.0 to 1.65.0
- [#16283](https://github.com/influxdata/telegraf/pull/16283) `deps` Bump cloud.google.com/go/monitoring from 1.21.1 to 1.22.0
- [#16315](https://github.com/influxdata/telegraf/pull/16315) `deps` Bump github.com/Azure/go-autorest/autorest/adal from 0.9.23 to 0.9.24
- [#16319](https://github.com/influxdata/telegraf/pull/16319) `deps` Bump github.com/IBM/nzgo/v12 from 12.0.9-0.20231115043259-49c27f2dfe48 to 12.0.9
- [#16346](https://github.com/influxdata/telegraf/pull/16346) `deps` Bump github.com/Masterminds/semver/v3 from 3.3.0 to 3.3.1
- [#16280](https://github.com/influxdata/telegraf/pull/16280) `deps` Bump github.com/aws/aws-sdk-go-v2/config from 1.27.39 to 1.28.6
- [#16343](https://github.com/influxdata/telegraf/pull/16343) `deps` Bump github.com/aws/aws-sdk-go-v2/service/ec2 from 1.162.1 to 1.198.1
- [#16317](https://github.com/influxdata/telegraf/pull/16317) `deps` Bump github.com/fatih/color from 1.17.0 to 1.18.0
- [#16345](https://github.com/influxdata/telegraf/pull/16345) `deps` Bump github.com/gopacket/gopacket from 1.3.0 to 1.3.1
- [#16282](https://github.com/influxdata/telegraf/pull/16282) `deps` Bump github.com/nats-io/nats.go from 1.36.0 to 1.37.0
- [#16318](https://github.com/influxdata/telegraf/pull/16318) `deps` Bump github.com/prometheus/common from 0.60.0 to 0.61.0
- [#16324](https://github.com/influxdata/telegraf/pull/16324) `deps` Bump github.com/vapourismo/knx-go from v0.0.0-20240217175130-922a0d50c241 to v0.0.0-20240915133544-a6ab43471c11
- [#16297](https://github.com/influxdata/telegraf/pull/16297) `deps` Bump golang.org/x/crypto from 0.29.0 to 0.31.0
- [#16281](https://github.com/influxdata/telegraf/pull/16281) `deps` Bump k8s.io/client-go from 0.30.1 to 0.31.3
- [#16313](https://github.com/influxdata/telegraf/pull/16313) `deps` Bump super-linter/super-linter from 7.2.0 to 7.2.1

## v1.33.0 [2024-12-09]

### New Plugins
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ vet:
.PHONY: lint-install
lint-install:
@echo "Installing golangci-lint"
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4

@echo "Installing markdownlint"
npm install -g markdownlint-cli
Expand Down
6 changes: 3 additions & 3 deletions agent/accumulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@ func TestAddTrackingMetricGroupEmpty(t *testing.T) {
type TestMetricMaker struct {
}

func (tm *TestMetricMaker) Name() string {
func (*TestMetricMaker) Name() string {
return "TestPlugin"
}

func (tm *TestMetricMaker) LogName() string {
return tm.Name()
}

func (tm *TestMetricMaker) MakeMetric(metric telegraf.Metric) telegraf.Metric {
func (*TestMetricMaker) MakeMetric(metric telegraf.Metric) telegraf.Metric {
return metric
}

func (tm *TestMetricMaker) Log() telegraf.Logger {
func (*TestMetricMaker) Log() telegraf.Logger {
return logger.New("TestPlugin", "test", "")
}
67 changes: 17 additions & 50 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,7 @@ func (a *Agent) initPersister() error {
return nil
}

func (a *Agent) startInputs(
dst chan<- telegraf.Metric,
inputs []*models.RunningInput,
) (*inputUnit, error) {
func (*Agent) startInputs(dst chan<- telegraf.Metric, inputs []*models.RunningInput) (*inputUnit, error) {
log.Printf("D! [agent] Starting service inputs")

unit := &inputUnit{
Expand Down Expand Up @@ -447,13 +444,9 @@ func (a *Agent) runInputs(
log.Printf("D! [agent] Input channel closed")
}

// testStartInputs is a variation of startInputs for use in --test and --once
// mode. It differs by logging Start errors and returning only plugins
// successfully started.
func (a *Agent) testStartInputs(
dst chan<- telegraf.Metric,
inputs []*models.RunningInput,
) *inputUnit {
// testStartInputs is a variation of startInputs for use in --test and --once mode.
// It differs by logging Start errors and returning only plugins successfully started.
func (*Agent) testStartInputs(dst chan<- telegraf.Metric, inputs []*models.RunningInput) *inputUnit {
log.Printf("D! [agent] Starting service inputs")

unit := &inputUnit{
Expand Down Expand Up @@ -582,14 +575,8 @@ func (a *Agent) gatherLoop(
}
}

// gatherOnce runs the input's Gather function once, logging a warning each
// interval it fails to complete before.
func (a *Agent) gatherOnce(
acc telegraf.Accumulator,
input *models.RunningInput,
ticker Ticker,
interval time.Duration,
) error {
// gatherOnce runs the input's Gather function once, logging a warning each interval it fails to complete before.
func (*Agent) gatherOnce(acc telegraf.Accumulator, input *models.RunningInput, ticker Ticker, interval time.Duration) error {
done := make(chan error)
go func() {
defer panicRecover(input)
Expand Down Expand Up @@ -617,12 +604,8 @@ func (a *Agent) gatherOnce(
}
}

// startProcessors sets up the processor chain and calls Start on all
// processors. If an error occurs any started processors are Stopped.
func (a *Agent) startProcessors(
dst chan<- telegraf.Metric,
runningProcessors models.RunningProcessors,
) (chan<- telegraf.Metric, []*processorUnit, error) {
// startProcessors sets up the processor chain and calls Start on all processors. If an error occurs any started processors are Stopped.
func (*Agent) startProcessors(dst chan<- telegraf.Metric, runningProcessors models.RunningProcessors) (chan<- telegraf.Metric, []*processorUnit, error) {
var src chan telegraf.Metric
units := make([]*processorUnit, 0, len(runningProcessors))
// The processor chain is constructed from the output side starting from
Expand Down Expand Up @@ -657,11 +640,8 @@ func (a *Agent) startProcessors(
return src, units, nil
}

// runProcessors begins processing metrics and runs until the source channel is
// closed and all metrics have been written.
func (a *Agent) runProcessors(
units []*processorUnit,
) {
// runProcessors begins processing metrics and runs until the source channel is closed and all metrics have been written.
func (*Agent) runProcessors(units []*processorUnit) {
var wg sync.WaitGroup
for _, unit := range units {
wg.Add(1)
Expand All @@ -684,7 +664,7 @@ func (a *Agent) runProcessors(
}

// startAggregators sets up the aggregator unit and returns the source channel.
func (a *Agent) startAggregators(aggC, outputC chan<- telegraf.Metric, aggregators []*models.RunningAggregator) (chan<- telegraf.Metric, *aggregatorUnit) {
func (*Agent) startAggregators(aggC, outputC chan<- telegraf.Metric, aggregators []*models.RunningAggregator) (chan<- telegraf.Metric, *aggregatorUnit) {
src := make(chan telegraf.Metric, 100)
unit := &aggregatorUnit{
src: src,
Expand Down Expand Up @@ -771,11 +751,7 @@ func updateWindow(start time.Time, roundInterval bool, period time.Duration) (ti
}

// push runs the push for a single aggregator every period.
func (a *Agent) push(
ctx context.Context,
aggregator *models.RunningAggregator,
acc telegraf.Accumulator,
) {
func (*Agent) push(ctx context.Context, aggregator *models.RunningAggregator, acc telegraf.Accumulator) {
for {
// Ensures that Push will be called for each period, even if it has
// already elapsed before this function is called. This is guaranteed
Expand Down Expand Up @@ -824,7 +800,7 @@ func (a *Agent) startOutputs(
}

// connectOutput connects to all outputs.
func (a *Agent) connectOutput(ctx context.Context, output *models.RunningOutput) error {
func (*Agent) connectOutput(ctx context.Context, output *models.RunningOutput) error {
log.Printf("D! [agent] Attempting connection to [%s]", output.LogName())
if err := output.Connect(); err != nil {
log.Printf("E! [agent] Failed to connect to [%s], retrying in 15s, error was %q", output.LogName(), err)
Expand Down Expand Up @@ -938,13 +914,8 @@ func (a *Agent) flushLoop(
}
}

// flushOnce runs the output's Write function once, logging a warning each
// interval it fails to complete before the flush interval elapses.
func (a *Agent) flushOnce(
output *models.RunningOutput,
ticker Ticker,
writeFunc func() error,
) error {
// flushOnce runs the output's Write function once, logging a warning each interval it fails to complete before the flush interval elapses.
func (*Agent) flushOnce(output *models.RunningOutput, ticker Ticker, writeFunc func() error) error {
done := make(chan error)
go func() {
done <- writeFunc()
Expand All @@ -963,12 +934,8 @@ func (a *Agent) flushOnce(
}
}

// flushBatch runs the output's Write function once Unlike flushOnce the
// interval elapsing is not considered during these flushes.
func (a *Agent) flushBatch(
output *models.RunningOutput,
writeFunc func() error,
) error {
// flushBatch runs the output's Write function once Unlike flushOnce the interval elapsing is not considered during these flushes.
func (*Agent) flushBatch(output *models.RunningOutput, writeFunc func() error) error {
err := writeFunc()
output.LogBufferStatus()
return err
Expand Down
Loading

0 comments on commit fde91fd

Please sign in to comment.