Skip to content

Commit

Permalink
Merge branch 'influxdata:master' into nats-js
Browse files Browse the repository at this point in the history
  • Loading branch information
neelayu authored Nov 30, 2023
2 parents 5763f0d + 6814d7a commit 9dbe42a
Show file tree
Hide file tree
Showing 308 changed files with 8,036 additions and 2,372 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ executors:
working_directory: '/go/src/github.com/influxdata/telegraf'
resource_class: large
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.21.3'
- image: 'quay.io/influxdb/telegraf-ci:1.21.4'
environment:
GOFLAGS: -p=4
mac:
Expand Down Expand Up @@ -40,7 +40,7 @@ commands:
default: "v1"
goversion:
type: string
default: 1.21.3
default: 1.21.4
steps:
- check-changed-files-or-halt
- when:
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
parameters:
goversion:
type: string
default: 1.21.3
default: 1.21.4
cache_version:
type: string
default: "v1"
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
parameters:
goversion:
type: string
default: 1.21.3
default: 1.21.4
cache_version:
type: string
default: "v1"
Expand Down Expand Up @@ -298,7 +298,7 @@ jobs:
parameters:
goversion:
type: string
default: 1.21.3
default: 1.21.4
cache_version:
type: string
default: "v1"
Expand All @@ -321,7 +321,7 @@ jobs:
parameters:
goversion:
type: string
default: 1.21.3
default: 1.21.4
cache_version:
type: string
default: "v1"
Expand Down Expand Up @@ -350,7 +350,7 @@ jobs:
parameters:
goversion:
type: string
default: 1.21.3
default: 1.21.4
cache_version:
type: string
default: "v1"
Expand Down
40 changes: 11 additions & 29 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
# Required for all PRs

<!-- Before opening a pull request you should run the following checks locally to make sure the CI will pass.
make lint
make check
make check-deps
make test
make docs
## Summary
<!-- Mandatory
Explain here the why, the rationale and motivation, for the changes.
-->

<!-- Complete the tasks in the following list. Change [ ] to [x] to
show completion. -->

- [ ] Updated associated README.md.
- [ ] Wrote appropriate unit tests.
- [ ] Pull request title or commits are in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/#summary)
## Checklist
<!-- Mandatory
Please confirm the following by placing an "x" between the []:
-->

<!-- Link to issues that describe the need for the change. Issues
should include context that will help reviewers understand why the
change is needed.
- [ ] No AI generated code was used in this PR

Make sure to link issues and using a keyword like "resolves #1234".
https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
## Related issues
<!-- Mandatory
All PRs should resolve an issue, if one does not exist, please open one.
-->

resolves #

<!-- Finally, include a summary of the code change itself. This
description should tell reviewers how the issues were resolved.
example: Fixed an off by one error in counter variable in type FooBar.
example: Added an input plugin to gather yak shaving metrics using
golang library yaktech/shaver. -->
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
- name: Scan for Vulnerabilities in Code
uses: golang/govulncheck-action@v1
with:
go-version-input: 1.21.3
go-version-input: 1.21.4
go-package: ./...
18 changes: 18 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ linters:
- sqlclosecheck
- staticcheck
- tenv
- testifylint
- tparallel
- typecheck
- unconvert
Expand Down Expand Up @@ -80,6 +81,7 @@ linters-settings:
- badCall
- badCond
- badLock
- badRegexp
- badSorting
- builtinShadowDecl
- caseOrder
Expand Down Expand Up @@ -246,6 +248,22 @@ linters-settings:
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
# Default: false
all: true
testifylint:
# Enable specific checkers.
# https://github.com/Antonboom/testifylint#checkers
# Default: ["bool-compare", "compares", "empty", "error-is-as", "error-nil", "expected-actual", "float-compare", "len", "require-error", "suite-dont-use-pkg", "suite-extra-assert-call"]
enable:
- bool-compare
- compares
- empty
- error-is-as
- error-nil
- expected-actual
- len
- require-error
- suite-dont-use-pkg
- suite-extra-assert-call
- suite-thelper

run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
Expand Down
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.github/PULL_REQUEST_TEMPLATE.md
docs/includes/*
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,64 @@
removes those useless fields. In case you reference them, please adapt your
queries!

## v1.28.5 [2023-11-15]

### Bugfixes

- [#14294](https://github.com/influxdata/telegraf/pull/14294) `inputs.ecs` Correct v4 metadata URLs
- [#14274](https://github.com/influxdata/telegraf/pull/14274) `inputs.intel_rdt` Do not fail on missing PIDs
- [#14283](https://github.com/influxdata/telegraf/pull/14283) `inputs.s7comm` Truncate strings to reported length
- [#14296](https://github.com/influxdata/telegraf/pull/14296) `parsers.json_v2` Log inner errors

### Dependency Updates

- [#14287](https://github.com/influxdata/telegraf/pull/14287) `deps` Bump github.com/gosnmp/gosnmp from 1.35.1-0.20230602062452-f30602b8dad6 to 1.36.1
- [#14286](https://github.com/influxdata/telegraf/pull/14286) `deps` Bump github.com/Masterminds/semver/v3 from 3.2.0 to 3.2.1
- [#14285](https://github.com/influxdata/telegraf/pull/14285) `deps` Bump golang.org/x/sync from 0.4.0 to 0.5.0
- [#14289](https://github.com/influxdata/telegraf/pull/14289) `deps` Bump golang.org/x/mod from 0.13.0 to 0.14.0
- [#14288](https://github.com/influxdata/telegraf/pull/14288) `deps` Bump google.golang.org/api from 0.149.0 to 0.150.0

## v1.28.4 [2023-11-13]

### Bugfixes

- [#14240](https://github.com/influxdata/telegraf/pull/14240) `config` Fix comment removal in TOML files
- [#14187](https://github.com/influxdata/telegraf/pull/14187) `inputs.cgroup` Escape backslashes in path
- [#14267](https://github.com/influxdata/telegraf/pull/14267) `inputs.disk` Add inodes_used_percent field
- [#14197](https://github.com/influxdata/telegraf/pull/14197) `inputs.ecs` Fix cgroupv2 CPU metrics
- [#14194](https://github.com/influxdata/telegraf/pull/14194) `inputs.ecs` Test for v4 metadata endpoint
- [#14262](https://github.com/influxdata/telegraf/pull/14262) `inputs.ipset` Parse lines with timeout
- [#14243](https://github.com/influxdata/telegraf/pull/14243) `inputs.mqtt_consumer` Resolve could not mark message delivered
- [#14195](https://github.com/influxdata/telegraf/pull/14195) `inputs.netflow` Fix sFlow metric timestamp
- [#14191](https://github.com/influxdata/telegraf/pull/14191) `inputs.prometheus` Read bearer token from file every time
- [#14068](https://github.com/influxdata/telegraf/pull/14068) `inputs.s7comm` Fix bit queries
- [#14241](https://github.com/influxdata/telegraf/pull/14241) `inputs.win_perf_counter` Do not rely on returned buffer size
- [#14176](https://github.com/influxdata/telegraf/pull/14176) `inputs.zfs` Parse metrics correctly on FreeBSD 14
- [#14280](https://github.com/influxdata/telegraf/pull/14280) `inputs.zfs` Support gathering metrics on zfs 2.2.0 and later
- [#14115](https://github.com/influxdata/telegraf/pull/14115) `outputs.elasticsearch` Print error status value
- [#14213](https://github.com/influxdata/telegraf/pull/14213) `outputs.timestream` Clip uint64 values
- [#14149](https://github.com/influxdata/telegraf/pull/14149) `parsers.json_v2` Prevent race condition in parse function

### Dependency Updates

- [#14253](https://github.com/influxdata/telegraf/pull/14253) `deps` Bump cloud.google.com/go/storage from 1.30.1 to 1.34.1
- [#14218](https://github.com/influxdata/telegraf/pull/14218) `deps` Bump github.com/aws/aws-sdk-go-v2/config from 1.18.42 to 1.19.1
- [#14167](https://github.com/influxdata/telegraf/pull/14167) `deps` Bump github.com/aws/aws-sdk-go-v2/credentials from 1.13.40 to 1.13.43
- [#14249](https://github.com/influxdata/telegraf/pull/14249) `deps` Bump github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs from 1.23.5 to 1.26.0
- [#14166](https://github.com/influxdata/telegraf/pull/14166) `deps` Bump github.com/antchfx/xmlquery from 1.3.17 to 1.3.18
- [#14217](https://github.com/influxdata/telegraf/pull/14217) `deps` Bump github.com/antchfx/xpath from 1.2.5-0.20230505064641-588960cceeac to 1.2.5
- [#14219](https://github.com/influxdata/telegraf/pull/14219) `deps` Bump github.com/benbjohnson/clock from 1.3.3 to 1.3.5
- [#14216](https://github.com/influxdata/telegraf/pull/14216) `deps` Bump github.com/compose-spec/compose-go from 1.16.0 to 1.20.0
- [#14211](https://github.com/influxdata/telegraf/pull/14211) `deps` Bump github.com/docker/docker from 24.0.6 to 24.0.7
- [#14164](https://github.com/influxdata/telegraf/pull/14164) `deps` Bump github.com/hashicorp/consul/api from 1.24.0 to 1.25.1
- [#14251](https://github.com/influxdata/telegraf/pull/14251) `deps` Bump github.com/hashicorp/consul/api from 1.25.1 to 1.26.1
- [#14225](https://github.com/influxdata/telegraf/pull/14225) `deps` Bump github.com/nats-io/nkeys from 0.4.5 to 0.4.6
- [#14168](https://github.com/influxdata/telegraf/pull/14168) `deps` Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0
- [#14252](https://github.com/influxdata/telegraf/pull/14252) `deps` Bump github.com/rabbitmq/amqp091-go from 1.8.1 to 1.9.0
- [#14250](https://github.com/influxdata/telegraf/pull/14250) `deps` Bump github.com/showwin/speedtest-go from 1.6.6 to 1.6.7
- [#14192](https://github.com/influxdata/telegraf/pull/14192) `deps` Bump google.golang.org/grpc from 1.58.2 to 1.58.3
- [#14165](https://github.com/influxdata/telegraf/pull/14165) `deps` Bump k8s.io/client-go from 0.28.2 to 0.28.3

## v1.28.3 [2023-10-23]

### Bugfixes
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ We recommend posting support questions in our [Community Slack](https://influxda

## Contributing code

### AI Generated Code

We currently cannot accept AI generated code contributions. Code contributed
should be your own per the CLA.

### Creating a pull request

1. [Sign the CLA][cla].
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ plugins/parsers/influx/machine.go: plugins/parsers/influx/machine.go.rl

.PHONY: ci
ci:
docker build -t quay.io/influxdb/telegraf-ci:1.21.3 - < scripts/ci.docker
docker push quay.io/influxdb/telegraf-ci:1.21.3
docker build -t quay.io/influxdb/telegraf-ci:1.21.4 - < scripts/ci.docker
docker push quay.io/influxdb/telegraf-ci:1.21.4

.PHONY: install
install: $(buildbin)
Expand Down
4 changes: 2 additions & 2 deletions cmd/telegraf/main_win_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func TestWindowsFlagsAreSet(t *testing.T) {
require.Equal(t, expectedString, m.serviceName)
require.Equal(t, expectedString, m.serviceDisplayName)
require.Equal(t, expectedString, m.serviceRestartDelay)
require.Equal(t, true, m.serviceAutoRestart)
require.Equal(t, true, m.console)
require.True(t, m.serviceAutoRestart)
require.True(t, m.console)
}
99 changes: 0 additions & 99 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"sync"
"time"

"github.com/compose-spec/compose-go/template"
"github.com/compose-spec/compose-go/utils"
"github.com/coreos/go-semver/semver"
"github.com/influxdata/toml"
"github.com/influxdata/toml/ast"
Expand Down Expand Up @@ -790,103 +788,6 @@ func parseConfig(contents []byte) (*ast.Table, error) {
return toml.Parse(outputBytes)
}

func removeComments(contents []byte) ([]byte, error) {
tomlReader := bytes.NewReader(contents)

// Initialize variables for tracking state
var inQuote, inComment, escaped bool
var quoteChar byte

// Initialize buffer for modified TOML data
var output bytes.Buffer

buf := make([]byte, 1)
// Iterate over each character in the file
for {
_, err := tomlReader.Read(buf)
if err != nil {
if errors.Is(err, io.EOF) {
break
}
return nil, err
}
char := buf[0]

// Toggle the escaped state at backslash to we have true every odd occurrence.
if char == '\\' {
escaped = !escaped
}

if inComment {
// If we're currently in a comment, check if this character ends the comment
if char == '\n' {
// End of line, comment is finished
inComment = false
_, _ = output.WriteRune('\n')
}
} else if inQuote {
// If we're currently in a quote, check if this character ends the quote
if char == quoteChar && !escaped {
// End of quote, we're no longer in a quote
inQuote = false
}
output.WriteByte(char)
} else {
// Not in a comment or a quote
if (char == '"' || char == '\'') && !escaped {
// Start of quote
inQuote = true
quoteChar = char
output.WriteByte(char)
} else if char == '#' && !escaped {
// Start of comment
inComment = true
} else {
// Not a comment or a quote, just output the character
output.WriteByte(char)
}
}

// Reset escaping if any other character occurred
if char != '\\' {
escaped = false
}
}
return output.Bytes(), nil
}

func substituteEnvironment(contents []byte, oldReplacementBehavior bool) ([]byte, error) {
options := []template.Option{
template.WithReplacementFunction(func(s string, m template.Mapping, cfg *template.Config) (string, error) {
result, applied, err := template.DefaultReplacementAppliedFunc(s, m, cfg)
if err == nil && !applied {
// Keep undeclared environment-variable patterns to reproduce
// pre-v1.27 behavior
return s, nil
}
if err != nil && strings.HasPrefix(err.Error(), "Invalid template:") {
// Keep invalid template patterns to ignore regexp substitutions
// like ${1}
return s, nil
}
return result, err
}),
template.WithoutLogging,
}
if oldReplacementBehavior {
options = append(options, template.WithPattern(oldVarRe))
}

envMap := utils.GetAsEqualsMap(os.Environ())
retVal, err := template.SubstituteWithOptions(string(contents), func(k string) (string, bool) {
if v, ok := envMap[k]; ok {
return v, ok
}
return "", false
}, options...)
return []byte(retVal), err
}

func (c *Config) addAggregator(name string, table *ast.Table) error {
creator, ok := aggregators.Aggregators[name]
if !ok {
Expand Down
6 changes: 3 additions & 3 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func TestConfig_SerializerInterfaceNewFormat(t *testing.T) {
options = append(options, cmpopts.IgnoreFields(stype, settings.mask...))
}

// Do a manual comparision as require.EqualValues will also work on unexported fields
// Do a manual comparison as require.EqualValues will also work on unexported fields
// that cannot be cleared or ignored.
diff := cmp.Diff(expected[i], actual[i], options...)
require.Emptyf(t, diff, "Difference in SetSerializer() for %q", format)
Expand Down Expand Up @@ -820,7 +820,7 @@ func TestConfig_ParserInterface(t *testing.T) {
options = append(options, cmpopts.IgnoreFields(stype, settings.mask...))
}

// Do a manual comparision as require.EqualValues will also work on unexported fields
// Do a manual comparison as require.EqualValues will also work on unexported fields
// that cannot be cleared or ignored.
diff := cmp.Diff(expected[i], actual[i], options...)
require.Emptyf(t, diff, "Difference in SetParser() for %q", format)
Expand Down Expand Up @@ -1039,7 +1039,7 @@ func TestConfig_ProcessorsWithParsers(t *testing.T) {
options = append(options, cmpopts.IgnoreFields(stype, settings.mask...))
}

// Do a manual comparision as require.EqualValues will also work on unexported fields
// Do a manual comparison as require.EqualValues will also work on unexported fields
// that cannot be cleared or ignored.
diff := cmp.Diff(expected[i], actual[i], options...)
require.Emptyf(t, diff, "Difference in SetParser() for %q", format)
Expand Down
Loading

0 comments on commit 9dbe42a

Please sign in to comment.