From 6cadd282daeba8886b988728a9f2f2fb58da5d88 Mon Sep 17 00:00:00 2001 From: Bruno Teixeira Date: Tue, 26 Nov 2024 09:11:40 +0000 Subject: [PATCH] fix/condition for parallelism --- exporter/prometheusremotewriteexporter/config.go | 2 +- exporter/prometheusremotewriteexporter/factory.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/exporter/prometheusremotewriteexporter/config.go b/exporter/prometheusremotewriteexporter/config.go index 9f1bf6ea7c7a..0ed80dd25d78 100644 --- a/exporter/prometheusremotewriteexporter/config.go +++ b/exporter/prometheusremotewriteexporter/config.go @@ -90,7 +90,7 @@ var _ component.Config = (*Config)(nil) // Validate checks if the exporter configuration is valid func (cfg *Config) Validate() error { - if cfg.MaxBatchRequestParallelism <= 1 { + if cfg.MaxBatchRequestParallelism < 1 { return fmt.Errorf("max_batch_request_parallelism can't be set to below 1") } diff --git a/exporter/prometheusremotewriteexporter/factory.go b/exporter/prometheusremotewriteexporter/factory.go index 4ac986a7e8e3..fb5054c1e3d5 100644 --- a/exporter/prometheusremotewriteexporter/factory.go +++ b/exporter/prometheusremotewriteexporter/factory.go @@ -88,6 +88,10 @@ func createDefaultConfig() component.Config { clientConfig.WriteBufferSize = 512 * 1024 clientConfig.Timeout = exporterhelper.NewDefaultTimeoutConfig().Timeout + numConsumers := 5 + if enableMultipleWorkersFeatureGate.IsEnabled() { + numConsumers = 1 + } return &Config{ Namespace: "", ExternalLabels: map[string]string{}, @@ -102,7 +106,7 @@ func createDefaultConfig() component.Config { RemoteWriteQueue: RemoteWriteQueue{ Enabled: true, QueueSize: 10000, - NumConsumers: 5, + NumConsumers: numConsumers, }, TargetInfo: &TargetInfo{ Enabled: true,