Skip to content

Commit

Permalink
fixing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Paramadon committed Sep 27, 2024
1 parent ad3221e commit 3d0fd69
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/procstat/memmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions plugins/inputs/procstat/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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)
Expand Down
8 changes: 2 additions & 6 deletions plugins/inputs/procstat/procstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type Procstat struct {
Properties []string `toml:"properties"`

cfg collectionConfig
oldMode bool
solarisMode bool
finder PIDFinder
createPIDFinder func() (PIDFinder, error)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions plugins/inputs/procstat/procstat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package procstat

import (
"fmt"
"github.com/influxdata/telegraf"
"os"
"os/exec"
"path/filepath"
Expand All @@ -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"
)

Expand Down

0 comments on commit 3d0fd69

Please sign in to comment.