From 45a8c85bf9efc9bb110d6c9b7bececd78a2e1de1 Mon Sep 17 00:00:00 2001 From: Lars Stegman Date: Fri, 20 Sep 2024 14:49:18 +0200 Subject: [PATCH] feat(inputs): don't check time source setting for service inputs --- models/running_input.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/models/running_input.go b/models/running_input.go index 34fe4ce3367c2..29c9340dee4fc 100644 --- a/models/running_input.go +++ b/models/running_input.go @@ -125,12 +125,14 @@ func (r *RunningInput) Init() error { return fmt.Errorf("invalid 'startup_error_behavior' setting %q", r.Config.StartupErrorBehavior) } - switch r.Config.TimeSource { - case "": - r.Config.TimeSource = TimeSourceMetric - case TimeSourceMetric, TimeSourceCollectionStart, TimeSourceCollectionEnd: - default: - return fmt.Errorf("invalid 'time_source' setting %q", r.Config.TimeSource) + if _, ok := r.Input.(telegraf.ServiceInput); !ok { + switch r.Config.TimeSource { + case "": + r.Config.TimeSource = TimeSourceMetric + case TimeSourceMetric, TimeSourceCollectionStart, TimeSourceCollectionEnd: + default: + return fmt.Errorf("invalid 'time_source' setting %q", r.Config.TimeSource) + } } if p, ok := r.Input.(telegraf.Initializer); ok {