chore: Fix linter findings for `revive:enforce-map-style` in `plugins/outputs` (#15981)
This commit is contained in:
parent
809480ee59
commit
ce0f4b0dc8
|
|
@ -205,7 +205,7 @@ func (c *CloudWatchLogs) Connect() error {
|
|||
c.Log.Debugf("Log stream %q...", c.lsSource)
|
||||
}
|
||||
|
||||
c.ls = map[string]*logStreamContainer{}
|
||||
c.ls = make(map[string]*logStreamContainer)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ func uniqKeyFromTagList(ts []*telegraf.Tag) (k string) {
|
|||
func newStream(ts []*telegraf.Tag) *Stream {
|
||||
s := &Stream{
|
||||
Logs: make([]Log, 0),
|
||||
Labels: map[string]string{},
|
||||
Labels: make(map[string]string, len(ts)),
|
||||
}
|
||||
|
||||
for _, t := range ts {
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ import (
|
|||
var sampleConfig string
|
||||
|
||||
func (s *MongoDB) getCollections(ctx context.Context) error {
|
||||
s.collections = map[string]bson.M{}
|
||||
collections, err := s.client.Database(s.MetricDatabase).ListCollections(ctx, bson.M{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to execute ListCollections: %w", err)
|
||||
}
|
||||
s.collections = make(map[string]bson.M, collections.RemainingBatchLength())
|
||||
for collections.Next(ctx) {
|
||||
var collection bson.M
|
||||
if err = collections.Decode(&collection); err != nil {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ func (a *NebiusCloudMonitoring) Init() error {
|
|||
},
|
||||
Timeout: time.Duration(a.Timeout),
|
||||
}
|
||||
tags := map[string]string{}
|
||||
tags := make(map[string]string)
|
||||
a.MetricOutsideWindow = selfstat.Register("nebius_cloud_monitoring", "metric_outside_window", tags)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type columnList struct {
|
|||
|
||||
func newColumnList() *columnList {
|
||||
return &columnList{
|
||||
indices: map[string]int{},
|
||||
indices: make(map[string]int),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ type TableSource struct {
|
|||
}
|
||||
|
||||
func NewTableSources(p *Postgresql, metrics []telegraf.Metric) map[string]*TableSource {
|
||||
tableSources := map[string]*TableSource{}
|
||||
tableSources := make(map[string]*TableSource)
|
||||
|
||||
for _, m := range metrics {
|
||||
tsrc := tableSources[m.Name()]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
type Creator func() telegraf.Output
|
||||
|
||||
var Outputs = map[string]Creator{}
|
||||
var Outputs = make(map[string]Creator)
|
||||
|
||||
func Add(name string, creator Creator) {
|
||||
Outputs[name] = creator
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ func (a *YandexCloudMonitoring) Connect() error {
|
|||
|
||||
a.Log.Infof("Writing to Yandex.Cloud Monitoring URL: %s", a.EndpointURL)
|
||||
|
||||
tags := map[string]string{}
|
||||
tags := make(map[string]string)
|
||||
a.MetricOutsideWindow = selfstat.Register("yandex_cloud_monitoring", "metric_outside_window", tags)
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue