Skip to content

Commit

Permalink
Move ratelimiting pieces all to one package
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan committed Dec 4, 2024
1 parent 21ac3f2 commit 1896438
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugins/common/ratelimiter/serializers.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package limited
package ratelimiter

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion plugins/common/ratelimiter/serializers_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package limited
package ratelimiter

import (
"math"
Expand Down
3 changes: 1 addition & 2 deletions plugins/outputs/influxdb_v2/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/common/limited"
"github.com/influxdata/telegraf/plugins/common/ratelimiter"
)

Expand Down Expand Up @@ -61,7 +60,7 @@ type httpClient struct {
readIdleTimeout config.Duration
tlsConfig *tls.Config
encoder internal.ContentEncoder
serializer limited.Serializer
serializer ratelimiter.Serializer
rateLimiter *ratelimiter.RateLimiter
client *http.Client
params url.Values
Expand Down
5 changes: 2 additions & 3 deletions plugins/outputs/influxdb_v2/influxdb_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/common/limited"
"github.com/influxdata/telegraf/plugins/common/ratelimiter"
commontls "github.com/influxdata/telegraf/plugins/common/tls"
"github.com/influxdata/telegraf/plugins/outputs"
Expand Down Expand Up @@ -50,7 +49,7 @@ type InfluxDB struct {

clients []*httpClient
encoder internal.ContentEncoder
serializer limited.Serializer
serializer ratelimiter.Serializer
tlsCfg *tls.Config
}

Expand Down Expand Up @@ -90,7 +89,7 @@ func (i *InfluxDB) Init() error {
if err := serializer.Init(); err != nil {
return fmt.Errorf("setting up serializer failed: %w", err)
}
i.serializer = limited.NewIndividualSerializer(serializer)
i.serializer = ratelimiter.NewIndividualSerializer(serializer)

// Setup the client config
tlsCfg, err := i.ClientConfig.TLSConfig()
Expand Down

0 comments on commit 1896438

Please sign in to comment.