Skip to content

Commit fb1f93b

Browse files
committed
Update naming and comments
1 parent ffb2bec commit fb1f93b

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

internal/component/common/loki/client/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ type Config struct {
3333
// prevent HOL blocking in multitenant deployments.
3434
DropRateLimitedBatches bool
3535

36-
// Queue controls configuration parameters specific to the queue client
37-
Queue QueueConfig
36+
// QueueConfig controls how shards and queues are configured for endpoints.
37+
QueueConfig QueueConfig
3838
}
3939

40-
// QueueConfig holds configurations for the queue-based remote-write client.
40+
// QueueConfig controls how shards and queue are configured for client.
4141
type QueueConfig struct {
4242
// Capacity is the worst case size in bytes desired for the send queue. This value is used to calculate the size of
4343
// the buffered channel used underneath. The worst case scenario assumed is that every batch buffered in full, hence
@@ -50,6 +50,6 @@ type QueueConfig struct {
5050
// MinShards is the minimum number of concurrent shards sending batches to the endpoint.
5151
MinShards int
5252

53-
// DrainTimeout controls the maximum time that draining the send queue can take.
53+
// DrainTimeout controls the maximum time that draining the queue can take.
5454
DrainTimeout time.Duration
5555
}

internal/component/common/loki/client/consumer_fanout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func newEndpoint(metrics *Metrics, cfg Config, logger log.Logger) (*endpoint, er
138138
cancel: cancel,
139139
}
140140

141-
c.shards.start(cfg.Queue.MinShards)
141+
c.shards.start(cfg.QueueConfig.MinShards)
142142

143143
c.wg.Go(func() { c.run() })
144144
return c, nil

internal/component/common/loki/client/consumer_fanout_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ func newServerAndEndpointConfig(t *testing.T) (Config, chan utils.RemoteWriteReq
628628
BackoffConfig: backoff.Config{
629629
MaxRetries: 0,
630630
},
631-
Queue: QueueConfig{
631+
QueueConfig: QueueConfig{
632632
Capacity: 10, // buffered channel of size 10
633633
DrainTimeout: time.Second * 10,
634634
},

internal/component/common/loki/client/consumer_wal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func newWalEndpoint(metrics *Metrics, wcMetrics *WALEndpointMetrics, cfg Config,
164164
markerHandler: markerHandler,
165165
}
166166

167-
c.shards.start(cfg.Queue.MinShards)
167+
c.shards.start(cfg.QueueConfig.MinShards)
168168

169169
return c, nil
170170
}

internal/component/common/loki/client/consumer_wal_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func TestWALEndpoint(t *testing.T) {
255255
BackoffConfig: backoff.Config{MinBackoff: 5 * time.Second, MaxBackoff: 10 * time.Second, MaxRetries: 1},
256256
Timeout: 1 * time.Second,
257257
TenantID: "",
258-
Queue: tc.queueConfig,
258+
QueueConfig: tc.queueConfig,
259259
}
260260

261261
logger := log.NewLogfmtLogger(os.Stdout)
@@ -394,7 +394,7 @@ func runWALEndpointBenchCase(b *testing.B, bc testCase, mhFactory func(t *testin
394394
BackoffConfig: backoff.Config{MinBackoff: 5 * time.Second, MaxBackoff: 10 * time.Second, MaxRetries: 1},
395395
Timeout: 1 * time.Second,
396396
TenantID: "",
397-
Queue: QueueConfig{
397+
QueueConfig: QueueConfig{
398398
Capacity: 1000, // queue size of 100
399399
DrainTimeout: time.Second * 10,
400400
},
@@ -485,7 +485,7 @@ func runEndpointBenchCase(b *testing.B, bc testCase) {
485485
BackoffConfig: backoff.Config{MinBackoff: 5 * time.Second, MaxBackoff: 10 * time.Second, MaxRetries: 1},
486486
Timeout: 1 * time.Second,
487487
TenantID: "",
488-
Queue: QueueConfig{
488+
QueueConfig: QueueConfig{
489489
Capacity: 1000, // queue size of 100
490490
DrainTimeout: time.Second * 10,
491491
},

internal/component/common/loki/client/shards.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func newQueue(metrics *Metrics, logger log.Logger, cfg Config) *queue {
4141
// the channel capacity would be calculated as: bufferChannelSize = Capacity / BatchSize.
4242
// For example, assuming BatchSize is the 1 MiB default and Capacity is 100 MiB,
4343
// the underlying buffered channel would buffer up to 100 batches.
44-
capacity := max(cfg.Queue.Capacity/max(cfg.BatchSize, 1), 1)
44+
capacity := max(cfg.QueueConfig.Capacity/max(cfg.BatchSize, 1), 1)
4545

4646
return &queue{
4747
cfg: cfg,
@@ -278,7 +278,7 @@ func (s *shards) stop() {
278278
select {
279279
case <-s.done:
280280
return
281-
case <-time.After(s.cfg.Queue.DrainTimeout):
281+
case <-time.After(s.cfg.QueueConfig.DrainTimeout):
282282
}
283283

284284
// Perform hard shutdown

internal/component/common/loki/client/shards_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestQueue_append(t *testing.T) {
2424
// a queue with 8 bytes batches and only one batch can queued.
2525
q := newQueue(NewMetrics(prometheus.NewRegistry()), log.NewNopLogger(), Config{
2626
BatchSize: 8,
27-
Queue: QueueConfig{
27+
QueueConfig: QueueConfig{
2828
Capacity: 8,
2929
},
3030
})
@@ -61,7 +61,7 @@ func TestQueue_drain(t *testing.T) {
6161
// a queue with 8 bytes batches and only one batch can queued at any given time.
6262
q := newQueue(NewMetrics(prometheus.NewRegistry()), log.NewNopLogger(), Config{
6363
BatchSize: 8,
64-
Queue: QueueConfig{
64+
QueueConfig: QueueConfig{
6565
Capacity: 8,
6666
},
6767
})
@@ -83,7 +83,7 @@ func TestQueue_drain(t *testing.T) {
8383
q := newQueue(NewMetrics(prometheus.NewRegistry()), log.NewNopLogger(), Config{
8484
BatchSize: 8,
8585
BatchWait: 10 * time.Second,
86-
Queue: QueueConfig{
86+
QueueConfig: QueueConfig{
8787
Capacity: 8,
8888
},
8989
})
@@ -106,7 +106,7 @@ func TestQueue_flushAndShutdown(t *testing.T) {
106106
// a queue with 8 bytes batches and only one batch can queued at any given time.
107107
q := newQueue(NewMetrics(prometheus.NewRegistry()), log.NewNopLogger(), Config{
108108
BatchSize: 8,
109-
Queue: QueueConfig{
109+
QueueConfig: QueueConfig{
110110
Capacity: 8,
111111
},
112112
})
@@ -144,7 +144,7 @@ func TestQueue_flushAndShutdown(t *testing.T) {
144144
// a queue with 8 bytes batches and only one batch can queued at any given time.
145145
q := newQueue(NewMetrics(prometheus.NewRegistry()), log.NewNopLogger(), Config{
146146
BatchSize: 8,
147-
Queue: QueueConfig{
147+
QueueConfig: QueueConfig{
148148
Capacity: 8,
149149
},
150150
})

internal/component/loki/write/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (r *EndpointOptions) Validate() error {
7070
return nil
7171
}
7272

73-
// QueueConfig controls how shards and queue are configured for client.
73+
// QueueConfig controls how shards and queue are configured for endpoint.
7474
type QueueConfig struct {
7575
Capacity units.Base2Bytes `alloy:"capacity,attr,optional"`
7676
MinShards int `alloy:"min_shards,attr,optional"`
@@ -86,7 +86,7 @@ func (q *QueueConfig) SetToDefault() {
8686
}
8787
}
8888

89-
func (args Arguments) convertClientConfigs() []client.Config {
89+
func (args Arguments) convertEndpointConfigs() []client.Config {
9090
var res []client.Config
9191
for _, cfg := range args.Endpoints {
9292
url, _ := url.Parse(cfg.URL)
@@ -106,7 +106,7 @@ func (args Arguments) convertClientConfigs() []client.Config {
106106
TenantID: cfg.TenantID,
107107
MaxStreams: args.MaxStreams,
108108
DropRateLimitedBatches: !cfg.RetryOnHTTP429,
109-
Queue: client.QueueConfig{
109+
QueueConfig: client.QueueConfig{
110110
Capacity: int(cfg.QueueConfig.Capacity),
111111
MinShards: cfg.QueueConfig.MinShards,
112112
DrainTimeout: cfg.QueueConfig.DrainTimeout,

internal/component/loki/write/write.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (c *Component) Update(args component.Arguments) error {
164164
c.consumer.Stop()
165165
}
166166

167-
cfgs := newArgs.convertClientConfigs()
167+
cfgs := newArgs.convertEndpointConfigs()
168168

169169
uid := alloyseed.Get().UID
170170
for i := range cfgs {

0 commit comments

Comments
 (0)