Skip to content

Commit

Permalink
[release-1.13] fix: imc dispatcher doesn't have duplicate reporting o…
Browse files Browse the repository at this point in the history
…f metrics (#7873)

fix: imc dispatcher doesn't have duplicate reporting

Signed-off-by: Calum Murray <cmurray@redhat.com>
Co-authored-by: Calum Murray <cmurray@redhat.com>
  • Loading branch information
knative-prow-robot and Cali0707 committed Apr 26, 2024
1 parent 4745cd5 commit 1b8b450
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 @@ -241,14 +241,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 @@ -272,9 +272,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 1b8b450

Please sign in to comment.