Skip to content

Commit a1d9c86

Browse files
committed
Extend beholder log config for loops
1 parent c2968ea commit a1d9c86

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

pkg/loop/config.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ const (
6565
envTelemetryEmitterMaxQueueSize = "CL_TELEMETRY_EMITTER_MAX_QUEUE_SIZE"
6666
envTelemetryLogStreamingEnabled = "CL_TELEMETRY_LOG_STREAMING_ENABLED"
6767
envTelemetryLogLevel = "CL_TELEMETRY_LOG_LEVEL"
68+
envTelemetryLogBatchProcessor = "CL_TELEMETRY_LOG_BATCH_PROCESSOR"
69+
envTelemetryLogExportTimeout = "CL_TELEMETRY_LOG_EXPORT_TIMEOUT"
70+
envTelemetryLogExportMaxBatchSize = "CL_TELEMETRY_LOG_EXPORT_MAX_BATCH_SIZE"
71+
envTelemetryLogExportInterval = "CL_TELEMETRY_LOG_EXPORT_INTERVAL"
72+
envTelemetryLogMaxQueueSize = "CL_TELEMETRY_LOG_MAX_QUEUE_SIZE"
6873

6974
envChipIngressEndpoint = "CL_CHIP_INGRESS_ENDPOINT"
7075
envChipIngressInsecureConnection = "CL_CHIP_INGRESS_INSECURE_CONNECTION"
@@ -123,6 +128,11 @@ type EnvConfig struct {
123128
TelemetryEmitterMaxQueueSize int
124129
TelemetryLogStreamingEnabled bool
125130
TelemetryLogLevel zapcore.Level
131+
TelemetryLogBatchProcessor bool
132+
TelemetryLogExportTimeout time.Duration
133+
TelemetryLogExportMaxBatchSize int
134+
TelemetryLogExportInterval time.Duration
135+
TelemetryLogMaxQueueSize int
126136

127137
ChipIngressEndpoint string
128138
ChipIngressInsecureConnection bool
@@ -194,6 +204,11 @@ func (e *EnvConfig) AsCmdEnv() (env []string) {
194204
add(envTelemetryEmitterMaxQueueSize, strconv.Itoa(e.TelemetryEmitterMaxQueueSize))
195205
add(envTelemetryLogStreamingEnabled, strconv.FormatBool(e.TelemetryLogStreamingEnabled))
196206
add(envTelemetryLogLevel, e.TelemetryLogLevel.String())
207+
add(envTelemetryLogBatchProcessor, strconv.FormatBool(e.TelemetryLogBatchProcessor))
208+
add(envTelemetryLogExportTimeout, e.TelemetryLogExportTimeout.String())
209+
add(envTelemetryLogExportMaxBatchSize, strconv.Itoa(e.TelemetryLogExportMaxBatchSize))
210+
add(envTelemetryLogExportInterval, e.TelemetryLogExportInterval.String())
211+
add(envTelemetryLogMaxQueueSize, strconv.Itoa(e.TelemetryLogMaxQueueSize))
197212

198213
add(envChipIngressEndpoint, e.ChipIngressEndpoint)
199214
add(envChipIngressInsecureConnection, strconv.FormatBool(e.ChipIngressInsecureConnection))
@@ -371,6 +386,27 @@ func (e *EnvConfig) parse() error {
371386
logLevel = zapcore.InfoLevel // Fallback to info level on invalid input
372387
}
373388
e.TelemetryLogLevel = logLevel
389+
e.TelemetryLogBatchProcessor, err = getBool(envTelemetryLogBatchProcessor)
390+
if err != nil {
391+
return fmt.Errorf("failed to parse %s: %w", envTelemetryLogBatchProcessor, err)
392+
}
393+
e.TelemetryLogExportTimeout, err = getDuration(envTelemetryLogExportTimeout)
394+
if err != nil {
395+
return fmt.Errorf("failed to parse %s: %w", envTelemetryLogExportTimeout, err)
396+
}
397+
e.TelemetryLogExportMaxBatchSize, err = getInt(envTelemetryLogExportMaxBatchSize)
398+
if err != nil {
399+
return fmt.Errorf("failed to parse %s: %w", envTelemetryLogExportMaxBatchSize, err)
400+
}
401+
e.TelemetryLogExportInterval, err = getDuration(envTelemetryLogExportInterval)
402+
if err != nil {
403+
return fmt.Errorf("failed to parse %s: %w", envTelemetryLogExportInterval, err)
404+
}
405+
e.TelemetryLogMaxQueueSize, err = getInt(envTelemetryLogMaxQueueSize)
406+
if err != nil {
407+
return fmt.Errorf("failed to parse %s: %w", envTelemetryLogMaxQueueSize, err)
408+
}
409+
374410
// Optional
375411
e.ChipIngressEndpoint = os.Getenv(envChipIngressEndpoint)
376412
e.ChipIngressInsecureConnection, err = getBool(envChipIngressInsecureConnection)

pkg/loop/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ func (s *Server) start() error {
141141
EmitterMaxQueueSize: s.EnvConfig.TelemetryEmitterMaxQueueSize,
142142
LogStreamingEnabled: s.EnvConfig.TelemetryLogStreamingEnabled,
143143
LogLevel: s.EnvConfig.TelemetryLogLevel,
144+
LogBatchProcessor: s.EnvConfig.TelemetryLogBatchProcessor,
145+
LogExportTimeout: s.EnvConfig.TelemetryLogExportTimeout,
144146
ChipIngressEmitterEnabled: s.EnvConfig.ChipIngressEndpoint != "",
145147
ChipIngressEmitterGRPCEndpoint: s.EnvConfig.ChipIngressEndpoint,
146148
ChipIngressInsecureConnection: s.EnvConfig.ChipIngressInsecureConnection,

0 commit comments

Comments
 (0)