From 59607577f91972724b093a87a813c278eeb86009 Mon Sep 17 00:00:00 2001 From: Huiwen Date: Fri, 10 Nov 2023 12:10:15 +0000 Subject: [PATCH] log avg fetch time --- components/service-waiter/cmd/component.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/service-waiter/cmd/component.go b/components/service-waiter/cmd/component.go index ed7fdabe15710f..3568c8a96bc92b 100644 --- a/components/service-waiter/cmd/component.go +++ b/components/service-waiter/cmd/component.go @@ -155,8 +155,10 @@ func startWaitFeatureFlag(ctx context.Context, timeout time.Duration) { shouldSkipComponentWaiter = defaultSkip return } + startTime := time.Now() value, _, fetchTimes := ActualWaitFeatureFlag(featureFlagCtx, client, defaultSkip) - log.WithField("fetchTimes", fetchTimes).WithField("value", value).Info("get final value of feature flag") + avgTime := time.Since(startTime) / time.Duration(fetchTimes) + log.WithField("fetchTimes", fetchTimes).WithField("avgTime", avgTime).WithField("value", value).Info("get final value of feature flag") shouldSkipComponentWaiter = value }