Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: imc dispatcher doesn't have duplicate reporting of metrics #7870

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading