diff --git a/go.mod b/go.mod index 6508c34f8f0a2..c4c39261bb77d 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/influxdata/telegraf -go 1.21 - -toolchain go1.22.5 +go 1.20 require ( cloud.google.com/go/bigquery v1.55.0 diff --git a/plugins/inputs/procstat/memmap.go b/plugins/inputs/procstat/memmap.go index 149377835983a..c20513a5ad63c 100644 --- a/plugins/inputs/procstat/memmap.go +++ b/plugins/inputs/procstat/memmap.go @@ -2,6 +2,7 @@ package procstat +// pulled this from this commit https://github.com/influxdata/telegraf/pull/13779 func collectMemmap(proc Process, prefix string, fields map[string]any) { memMapStats, err := proc.MemoryMaps(true) if err == nil && len(*memMapStats) == 1 { diff --git a/plugins/inputs/procstat/process.go b/plugins/inputs/procstat/process.go index 139202212e9b6..7fa053d1c3bc3 100644 --- a/plugins/inputs/procstat/process.go +++ b/plugins/inputs/procstat/process.go @@ -2,10 +2,10 @@ package procstat import ( "fmt" - "github.com/influxdata/telegraf" - "github.com/influxdata/telegraf/metric" "time" + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/metric" "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/process" ) @@ -18,7 +18,6 @@ type Process interface { MemoryInfo() (*process.MemoryInfoStat, error) Name() (string, error) MemoryMaps(bool) (*[]process.MemoryMapsStat, error) - Metric(string, *collectionConfig) telegraf.Metric Cmdline() (string, error) NumCtxSwitches() (*process.NumCtxSwitchesStat, error) NumFDs() (int32, error) diff --git a/plugins/inputs/procstat/procstat.go b/plugins/inputs/procstat/procstat.go index 52ef595a562c1..d5ec8f56e3077 100644 --- a/plugins/inputs/procstat/procstat.go +++ b/plugins/inputs/procstat/procstat.go @@ -47,7 +47,6 @@ type Procstat struct { Properties []string `toml:"properties"` cfg collectionConfig - oldMode bool solarisMode bool finder PIDFinder createPIDFinder func() (PIDFinder, error) @@ -573,12 +572,9 @@ func (p *Procstat) Init() error { // Convert collection properties p.cfg.features = make(map[string]bool, len(p.Properties)) for _, prop := range p.Properties { - switch prop { - case "cpu", "limits", "memory", "mmap": //"cpu", "limits", "memory" not needed (might be useful for the future) - default: - return fmt.Errorf("invalid 'properties' setting %q", prop) + if prop == "mmap" { + p.cfg.features[prop] = true } - p.cfg.features[prop] = true } return nil diff --git a/plugins/inputs/procstat/procstat_test.go b/plugins/inputs/procstat/procstat_test.go index db53018ca5610..c29f80c924fbf 100644 --- a/plugins/inputs/procstat/procstat_test.go +++ b/plugins/inputs/procstat/procstat_test.go @@ -2,7 +2,6 @@ package procstat import ( "fmt" - "github.com/influxdata/telegraf" "os" "os/exec" "path/filepath" @@ -14,7 +13,8 @@ import ( "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/process" "github.com/stretchr/testify/require" - + + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/testutil" )