Skip to content

Commit

Permalink
chore: update to go1.19.1 (influxdata#11776)
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Sep 8, 2022
1 parent e46f90e commit 8c49ddc
Show file tree
Hide file tree
Showing 369 changed files with 687 additions and 309 deletions.
2 changes: 1 addition & 1 deletion .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.18.5'
- image: 'quay.io/influxdb/telegraf-ci:1.19.1'
environment:
GOFLAGS: -p=4
mac:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ plugins/parsers/influx/machine.go: plugins/parsers/influx/machine.go.rl

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

.PHONY: install
install: $(buildbin)
Expand Down
7 changes: 5 additions & 2 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type inputUnit struct {
// ______ ┌───────────┐ ______
// ()_____)──▶ │ Processor │──▶ ()_____)
// └───────────┘

type processorUnit struct {
src <-chan telegraf.Metric
dst chan<- telegraf.Metric
Expand All @@ -59,7 +60,7 @@ type processorUnit struct {
// aggregatorUnit is a group of Aggregators and their source and sink channels.
// Typically the aggregators write to a processor channel and pass the original
// metrics to the output channel. The sink channels may be the same channel.
//

// ┌────────────┐
// ┌──▶ │ Aggregator │───┐
// │ └────────────┘ │
Expand All @@ -71,6 +72,7 @@ type processorUnit struct {
// │ └────────────┘
// │ ______
// └────────────────────────▶ ()_____)

type aggregatorUnit struct {
src <-chan telegraf.Metric
aggC chan<- telegraf.Metric
Expand All @@ -80,7 +82,7 @@ type aggregatorUnit struct {

// outputUnit is a group of Outputs and their source channel. Metrics on the
// channel are written to all outputs.
//

// ┌────────┐
// ┌──▶ │ Output │
// │ └────────┘
Expand All @@ -90,6 +92,7 @@ type aggregatorUnit struct {
// │ ┌────────┐
// └──▶ │ Output │
// └────────┘

type outputUnit struct {
src <-chan telegraf.Metric
outputs []*models.RunningOutput
Expand Down
1 change: 1 addition & 0 deletions cmd/telegraf/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var globalTagsConfig = `
`

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the agentConfig data.
//
//go:embed agent.conf
var agentConfig string

Expand Down
9 changes: 4 additions & 5 deletions filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ type Filter interface {
// for matching a given string against the filter list. The filter list
// supports glob matching too, ie:
//
// f, _ := Compile([]string{"cpu", "mem", "net*"})
// f.Match("cpu") // true
// f.Match("network") // true
// f.Match("memory") // false
//
// f, _ := Compile([]string{"cpu", "mem", "net*"})
// f.Match("cpu") // true
// f.Match("network") // true
// f.Match("memory") // false
func Compile(filters []string) (Filter, error) {
// return if there is nothing to compile
if len(filters) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/influxdata/telegraf

go 1.18
go 1.19

// Workaround for https://github.com/lxc/lxd/issues/10745 (failing "go list -m all")
replace google.golang.org/grpc/naming => google.golang.org/grpc v1.29.1
Expand Down
4 changes: 2 additions & 2 deletions internal/snmp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func ClearCache() {
cache = make(map[string]bool)
}

//will give all found folders to gosmi and load in all modules found in the folders
// will give all found folders to gosmi and load in all modules found in the folders
func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) error {
folders, err := walkPaths(paths, log)
if err != nil {
Expand Down Expand Up @@ -89,7 +89,7 @@ func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) err
return nil
}

//should walk the paths given and find all folders
// should walk the paths given and find all folders
func walkPaths(paths []string, log telegraf.Logger) ([]string, error) {
once.Do(gosmi.Init)
folders := []string{}
Expand Down
18 changes: 10 additions & 8 deletions internal/templating/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,18 @@ type nodes []*node
// less than a non-wildcard value.
//
// For example, the filters:
// "*.*"
// "servers.*"
// "servers.localhost"
// "*.localhost"
//
// "*.*"
// "servers.*"
// "servers.localhost"
// "*.localhost"
//
// Would be sorted as:
// "servers.localhost"
// "servers.*"
// "*.localhost"
// "*.*"
//
// "servers.localhost"
// "servers.*"
// "*.localhost"
// "*.*"
func (n *nodes) Less(j, k int) bool {
if (*n)[j].value == "*" && (*n)[k].value != "*" {
return false
Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/basicstats/basicstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/derivative/derivative.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/final/final.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/histogram/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/merge/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/minmax/minmax.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/quantile/quantile.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/starlark/starlark.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/aggregators/valuecounter/valuecounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
8 changes: 4 additions & 4 deletions plugins/common/shim/example/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ var err error
// However, if you want to do all your config in code, you can like so:
//
// // initialize your plugin with any settings you want
// myInput := &mypluginname.MyPlugin{
// DefaultSettingHere: 3,
// }
//
// myInput := &mypluginname.MyPlugin{
// DefaultSettingHere: 3,
// }
//
// shim := shim.New()
//
// shim.AddInput(myInput)
//
// // now the shim.Run() call as below. Note the shim is only intended to run a single plugin.
//
func main() {
// parse command line options
flag.Parse()
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/activemq/activemq.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/aerospike/aerospike.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
3 changes: 2 additions & 1 deletion plugins/inputs/aliyuncms/aliyuncms.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down Expand Up @@ -341,7 +342,7 @@ func (s *AliyunCMS) gatherMetric(acc telegraf.Accumulator, metricName string, me
return nil
}

//tag helper
// tag helper
func parseTag(tagSpec string, data interface{}) (tagKey string, tagValue string, err error) {
var (
ok bool
Expand Down
16 changes: 8 additions & 8 deletions plugins/inputs/aliyuncms/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ type parsedDResp struct {
pageNumber int
}

//getRPCReqFromDiscoveryRequest - utility function to map between aliyun request primitives
//discoveryRequest represents different type of discovery requests
// getRPCReqFromDiscoveryRequest - utility function to map between aliyun request primitives
// discoveryRequest represents different type of discovery requests
func getRPCReqFromDiscoveryRequest(req discoveryRequest) (*requests.RpcRequest, error) {
if reflect.ValueOf(req).Type().Kind() != reflect.Ptr ||
reflect.ValueOf(req).IsNil() {
Expand All @@ -80,12 +80,12 @@ func getRPCReqFromDiscoveryRequest(req discoveryRequest) (*requests.RpcRequest,
return nil, errors.Errorf("didn't find *requests.RpcRequest embedded struct in %q", ptrV.Type())
}

//newDiscoveryTool function returns discovery tool object.
//The object is used to periodically get data about aliyun objects and send this
//data into channel. The intention is to enrich reported metrics with discovery data.
//Discovery is supported for a limited set of object types (defined by project) and can be extended in future.
//Discovery can be limited by region if not set, then all regions is queried.
//Request against API can inquire additional costs, consult with aliyun API documentation.
// newDiscoveryTool function returns discovery tool object.
// The object is used to periodically get data about aliyun objects and send this
// data into channel. The intention is to enrich reported metrics with discovery data.
// Discovery is supported for a limited set of object types (defined by project) and can be extended in future.
// Discovery can be limited by region if not set, then all regions is queried.
// Request against API can inquire additional costs, consult with aliyun API documentation.
func newDiscoveryTool(regions []string, project string, lg telegraf.Logger, credential auth.Credential, rateLimit int, discoveryInterval time.Duration) (*discoveryTool, error) {
var (
dscReq = map[string]discoveryRequest{}
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/amd_rocm_smi/amd_rocm_smi.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/amqp_consumer/amqp_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/apache/apache.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/apcupsd/apcupsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/aurora/aurora.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/azure_storage_queue/azure_storage_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/bcache/bcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/beanstalkd/beanstalkd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/beat/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/bond/bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/burrow/burrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/cassandra/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

// DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data.
//
//go:embed sample.conf
var sampleConfig string

Expand Down
Loading

0 comments on commit 8c49ddc

Please sign in to comment.