Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
apply new linting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Dec 9, 2022
1 parent 9782208 commit 2197473
Show file tree
Hide file tree
Showing 37 changed files with 39 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ linters:
- usestdlibvars
- varnamelen
- wrapcheck
# We disable those new linters as we are looking to minimize code changes.
- interfacebloat
- contextcheck


linters-settings:
Expand Down
2 changes: 1 addition & 1 deletion docs/monitors/collectd-jenkins.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Configuration](../monitor-config.md#common-configuration).**
| `path` | no | `string` | |
| `metricsKey` | **yes** | `string` | Key required for collecting metrics. The access key located at `Manage Jenkins > Configure System > Metrics > ADD.` If empty, click `Generate`. |
| `enhancedMetrics` | no | `bool` | Whether to enable enhanced metrics (**default:** `false`) |
| `excludeJobMetrics` | no | `bool` | Set to *true* to to exclude job metrics retrieved from `/api/json` endpoint (**default:** `false`) |
| `excludeJobMetrics` | no | `bool` | Set to *true* to exclude job metrics retrieved from `/api/json` endpoint (**default:** `false`) |
| `includeMetrics` | no | `list of strings` | Used to enable individual enhanced metrics when `enhancedMetrics` is false |
| `username` | no | `string` | User with security access to jenkins |
| `apiToken` | no | `string` | API Token of the user |
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/config/sources/zookeeper/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (z *zkConfigSource) Get(path string) (map[string][]byte, uint64, error) {
// ConfigSource since it doesn't have any concept of a global index counter
// that can be used to ensure updates aren't missed, and it also doesn't have
// the ability to watch child nodes recursively. Therefore, for now we just
// limit globbing to to asterisks at the very end of a node. If we need more
// limit globbing to asterisks at the very end of a node. If we need more
// complex globbing, consider something like
// https://github.com/kelseyhightower/confd/blob/master/backends/zookeeper/client.go
func (z *zkConfigSource) getNodes(path string, watch bool) (map[string][]byte, uint64, []<-chan zk.Event, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/writer/dimensions/dedup.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (dd *deduplicator) Add(dim *types.Dimension) {
}

// If we are merging dimension props/tags, then just keep all the updates
// in the the cached copy so we will know if an update is going to change
// in the cached copy so we will know if an update is going to change
// anything or not.
if cachedDim.Properties == nil {
cachedDim.Properties = map[string]string{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/writer/splunk/log_event_writer.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/monitors/aspdotnet/aspdotnet_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (m *Monitor) Configure(conf *Config) error {
// create the accumulator
ac := accumulator.NewAccumulator(emitter)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/cloudfoundry/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Monitor struct {
func (m *Monitor) Configure(conf *Config) error {
m.logger = logrus.WithFields(logrus.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/collectd/jenkins/jenkins.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Config struct {
MetricsKey string `yaml:"metricsKey" validate:"required"`
// Whether to enable enhanced metrics
EnhancedMetrics *bool `yaml:"enhancedMetrics"`
// Set to *true* to to exclude job metrics retrieved from `/api/json` endpoint
// Set to *true* to exclude job metrics retrieved from `/api/json` endpoint
ExcludeJobMetrics *bool `yaml:"excludeJobMetrics"`
// Used to enable individual enhanced metrics when `enhancedMetrics` is
// false
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/cpu/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (m *Monitor) initializePerCoreCPUTimes() {
func (m *Monitor) Configure(conf *Config) error {
m.logger = logrus.WithFields(logrus.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/diskio/diskio_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (m *Monitor) emitDatapoints() {
// Configure is the main function of the monitor, it will report host metadata
// on a varied interval
func (m *Monitor) Configure(conf *Config) error {
// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/diskio/diskio_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (m *Monitor) filterMeasurements(ms telegraf.Metric) error {
// on a varied interval
func (m *Monitor) Configure(conf *Config) error {

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/dotnet/dotnet_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (m *Monitor) Configure(conf *Config) error {
// create the accumulator
ac := accumulator.NewAccumulator(emitter)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/load/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Monitor struct {
func (m *Monitor) Configure(conf *Config) error {
m.logger = logrus.WithFields(logrus.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (m *Monitor) emitDatapoints() {
func (m *Monitor) Configure(conf *Config) error {
m.logger = log.WithFields(log.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/metadata/hostmetadata/hostmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (m *Monitor) Configure(conf *Config) error {
time.Duration(rand.Int63n(600)+86400) * time.Second,
}

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/netio/netio.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (m *Monitor) EmitDatapoints() {
func (m *Monitor) Configure(conf *Config) error {
m.logger = log.WithFields(log.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type Monitor struct {
func (m *Monitor) Configure(conf *Config) error {
m.logger = logrus.WithFields(logrus.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/common/accumulator/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type TrackingAccumulator struct {
done chan telegraf.DeliveryInfo
}

// AddTrackingMetric - Adds a metric to track on the the tracking accumulator
// AddTrackingMetric - Adds a metric to track on the tracking accumulator
func (ta *TrackingAccumulator) AddTrackingMetric(m telegraf.Metric) telegraf.TrackingID {
// TODO: maybe we'll care about these at some point,
// but for now dont worry about tracking metrics
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/monitors/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {

accumulator := accumulator.NewAccumulator(emitter)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/monitors/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {
return nil
})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/monitors/mssqlserver/mssqlserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (m *Monitor) Configure(conf *Config) error {
// create the accumulator
ac := accumulator.NewAccumulator(emit)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/monitors/procstat/procstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {
// and containerizing pgrep is likely difficult
plugin.PidFinder = "native"

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/monitors/tail/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {
// set the parser on the plugin
m.plugin.SetParserFunc(conf.TelegrafParser.GetTelegrafParser)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {

m.plugin.GrokConfig = grokConf

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {
plugin.Tables = append(plugin.Tables, t)
}

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/monitors/telegrafstatsd/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {
// create the accumulator
ac := accumulator.NewAccumulator(baseemitter.NewEmitter(m.Output, m.logger))

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/telegraf/monitors/varnish/varnish.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {

accumulator := accumulator.NewAccumulator(emitter)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (m *Monitor) Configure(conf *Config) error {
// create the accumulator
ac := accumulator.NewAccumulator(emitter)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (m *Monitor) Configure(conf *Config) (err error) {
// copy configurations to the plugin
plugin.ServiceNames = conf.ServiceNames

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/types/dims.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (d *Dimension) Key() DimensionKey {
}
}

// Copy creates a copy of the the given Dimension object
// Copy creates a copy of the given Dimension object
func (d *Dimension) Copy() *Dimension {
clonedProperties := make(map[string]string)
for k, v := range d.Properties {
Expand Down
1 change: 1 addition & 0 deletions pkg/monitors/types/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
// Output is the interface that monitors should use to send data to the agent
// core. It handles adding the proper dimensions and metadata to datapoints so
// that monitors don't have to worry about it themselves.

type Output interface {
Copy() Output
SendDatapoints(...*datapoint.Datapoint)
Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/vmem/vmem_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (m *Monitor) parseFileForDatapoints(contents []byte) []*datapoint.Datapoint
func (m *Monitor) Configure(conf *Config) (err error) {
m.logger = logrus.WithFields(logrus.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/vmem/vmem_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var metricNameMapping = map[string]string{
func (m *Monitor) Configure(conf *Config) (err error) {
m.logger = logrus.WithFields(logrus.Fields{"monitorType": monitorType, "monitorID": conf.MonitorID})

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/windowsiis/windowsiis_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (m *Monitor) Configure(conf *Config) error {
// create the accumulator
ac := accumulator.NewAccumulator(emitter)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/monitors/windowslegacy/windowslegacy_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (m *Monitor) Configure(conf *Config) error {
// create the accumulator
ac := accumulator.NewAccumulator(emitter)

// create contexts for managing the the plugin loop
// create contexts for managing the plugin loop
var ctx context.Context
ctx, m.cancel = context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/timeutil/duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Duration time.Duration
// ErrInvalidDuration is returned when the duration can't be interpreted
var ErrInvalidDuration = errors.New("the duration must be a string with time unit specified or an integer as seconds")

// AsDuration returns the the type cast to time.Duration
// AsDuration returns the type cast to time.Duration
func (d Duration) AsDuration() time.Duration {
return time.Duration(d)
}
Expand Down
2 changes: 1 addition & 1 deletion selfdescribe.json
Original file line number Diff line number Diff line change
Expand Up @@ -12702,7 +12702,7 @@
},
{
"yamlName": "excludeJobMetrics",
"doc": "Set to *true* to to exclude job metrics retrieved from `/api/json` endpoint",
"doc": "Set to *true* to exclude job metrics retrieved from `/api/json` endpoint",
"default": "false",
"required": false,
"type": "bool",
Expand Down

0 comments on commit 2197473

Please sign in to comment.