Skip to content

Commit 1b8b450

Browse files
[release-1.13] fix: imc dispatcher doesn't have duplicate reporting of metrics (#7873)
fix: imc dispatcher doesn't have duplicate reporting Signed-off-by: Calum Murray <[email protected]> Co-authored-by: Calum Murray <[email protected]>
1 parent 4745cd5 commit 1b8b450

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/channel/fanout/fanout_event_handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ func createEventReceiverFunction(f *FanoutEventHandler) func(context.Context, ch
241241
h.Set(apis.KnNamespaceHeader, ref.Namespace)
242242
// Any returned error is already logged in f.dispatch().
243243
dispatchResultForFanout := f.dispatch(ctx, subs, e, h)
244-
_ = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, *r, *args)
244+
245245
// If there are both http and https subscribers, we need to report the metrics for both of the type
246246
if hasHttpSubs {
247-
reportArgs.EventScheme = "http"
247+
args.EventScheme = "http"
248248
_ = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, *r, *args)
249249
}
250250
if hasHttpsSubs {
251-
reportArgs.EventScheme = "https"
251+
args.EventScheme = "https"
252252
_ = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, *r, *args)
253253
}
254254
}(evnt, additionalHeaders, parentSpan, &f.reporter, &reportArgs)
@@ -272,9 +272,9 @@ func createEventReceiverFunction(f *FanoutEventHandler) func(context.Context, ch
272272

273273
additionalHeaders.Set(apis.KnNamespaceHeader, ref.Namespace)
274274
dispatchResultForFanout := f.dispatch(ctx, subs, event, additionalHeaders)
275-
err := ParseDispatchResultAndReportMetrics(dispatchResultForFanout, f.reporter, reportArgs)
276275
// If there are both http and https subscribers, we need to report the metrics for both of the type
277276
// In this case we report http metrics because above we checked first for https and reported it so the left over metric to report is for http
277+
var err error
278278
if hasHttpSubs {
279279
reportArgs.EventScheme = "http"
280280
err = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, f.reporter, reportArgs)

0 commit comments

Comments
 (0)