From dc93ea7fe607cec54a58bf13d20cee75630c4df1 Mon Sep 17 00:00:00 2001 From: Olivier G Date: Fri, 22 Nov 2024 17:08:06 +0100 Subject: [PATCH] Set specific timeout for otel flare --- comp/otelcol/collector/impl-pipeline/pipeline.go | 6 ++++-- pkg/config/setup/config.go | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/comp/otelcol/collector/impl-pipeline/pipeline.go b/comp/otelcol/collector/impl-pipeline/pipeline.go index a0f72266efb8a..e3e2d89e2f87f 100644 --- a/comp/otelcol/collector/impl-pipeline/pipeline.go +++ b/comp/otelcol/collector/impl-pipeline/pipeline.go @@ -151,10 +151,12 @@ func NewComponent(reqs Requires) (Provides, error) { OnStart: collector.start, OnStop: collector.stop, }) - + timeoutCallback := func(flaretypes.FlareBuilder) time.Duration { + return time.Second * time.Duration(reqs.Config.GetInt("otelcollector.flare.timeout")) + } return Provides{ Comp: collector, - FlareProvider: flaretypes.NewProvider(collector.fillFlare), + FlareProvider: flaretypes.NewProviderWithTimeout(collector.fillFlare, timeoutCallback), StatusProvider: status.NewInformationProvider(collector), }, nil } diff --git a/pkg/config/setup/config.go b/pkg/config/setup/config.go index 1fef714a5b6a1..688dfac521ec6 100644 --- a/pkg/config/setup/config.go +++ b/pkg/config/setup/config.go @@ -876,6 +876,7 @@ func InitConfig(config pkgconfigmodel.Setup) { config.BindEnvAndSetDefault("otelcollector.extension_timeout", 0) // in seconds, 0 for default value config.BindEnvAndSetDefault("otelcollector.submit_dummy_metadata", false) // dev flag - to be removed config.BindEnvAndSetDefault("otelcollector.converter.enabled", true) + config.BindEnvAndSetDefault("otelcollector.flare.timeout", 60) // inventories config.BindEnvAndSetDefault("inventories_enabled", true)