Skip to content

Commit

Permalink
fix: imc dispatcher doesn't have duplicate reporting of metrics (#7870)
Browse files Browse the repository at this point in the history
fix: imc dispatcher doesn't have duplicate reporting

Signed-off-by: Calum Murray <cmurray@redhat.com>
  • Loading branch information
Cali0707 authored Apr 25, 2024
1 parent e23ebab commit 46e3677
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/channel/fanout/fanout_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ func createEventReceiverFunction(f *FanoutEventHandler) func(context.Context, ch
h.Set(apis.KnNamespaceHeader, ref.Namespace)
// Any returned error is already logged in f.dispatch().
dispatchResultForFanout := f.dispatch(ctx, subs, e, h)
_ = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, *r, *args)

// If there are both http and https subscribers, we need to report the metrics for both of the type
if hasHttpSubs {
reportArgs.EventScheme = "http"
args.EventScheme = "http"
_ = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, *r, *args)
}
if hasHttpsSubs {
reportArgs.EventScheme = "https"
args.EventScheme = "https"
_ = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, *r, *args)
}
}(evnt, additionalHeaders, parentSpan, &f.reporter, &reportArgs)
Expand All @@ -278,9 +278,9 @@ func createEventReceiverFunction(f *FanoutEventHandler) func(context.Context, ch

additionalHeaders.Set(apis.KnNamespaceHeader, ref.Namespace)
dispatchResultForFanout := f.dispatch(ctx, subs, event, additionalHeaders)
err := ParseDispatchResultAndReportMetrics(dispatchResultForFanout, f.reporter, reportArgs)
// If there are both http and https subscribers, we need to report the metrics for both of the type
// 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
var err error
if hasHttpSubs {
reportArgs.EventScheme = "http"
err = ParseDispatchResultAndReportMetrics(dispatchResultForFanout, f.reporter, reportArgs)
Expand Down

0 comments on commit 46e3677

Please sign in to comment.