-
Couldn't load subscription status.
- Fork 616
feat: migrate kncloudevents, broker filter, broker ingress, inmemorychannel dispatcher to otel #8635
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
Conversation
Signed-off-by: Calum Murray <[email protected]>
|
Skipping CI for Draft Pull Request. |
|
FYI @creydr after a few tries I'm feeling good about the approach I've taken here so far. Lmk what you think and I'll finish this up quickly tomorrow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Cali0707 for checking on this. For me the approach looks good so far. As I haven't done much with otel so far, maybe @evankanderson can check on the non-WIP PR later too (@evankanderson I only saw you reviewed some of the otel PRs in serving :D )
pkg/broker/filter/filter_handler.go
Outdated
| triggerInformer v1.TriggerInformer, | ||
| brokerInformer v1.BrokerInformer, | ||
| subscriptionInformer messaginginformers.SubscriptionInformer, | ||
| reporter StatsReporter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need the statsreporter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to refactor the metrics bits, but when I do we can drop it
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
|
This should be ready now |
Signed-off-by: Calum Murray <[email protected]>
|
/hold Looks like some other builds are breaking... |
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
|
/cc @creydr I have all the unit tests passing locally now 😄 Unfortunately, this ended up making the PR quite large, as I needed to instrument the broker ingress and the IMC dispatcher as well... Lmk what you think! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8635 +/- ##
==========================================
- Coverage 52.22% 52.17% -0.05%
==========================================
Files 402 401 -1
Lines 25174 25199 +25
==========================================
+ Hits 13147 13148 +1
- Misses 11224 11261 +37
+ Partials 803 790 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of smaller comments, but nothing to block doing the cleanup later (and I realize we're up against time boundaries on the release process).
/lgtm
|
|
||
| pprof := k8sruntime.NewProfilingServer(sl.Named("pprof")) | ||
|
|
||
| mp, tp := otel.SetupObservabilityOrDie(ctx, "broker.filter", sl, pprof) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiousity, why don't we set the global metrics / trace provider here, rather than needing to pass them into filter.NewHandler and filter.NewServerManager?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This doesn't need to change for this review, just wondering.)
| ctx = observability.WithMinimalEventLabels(ctx, event) | ||
| ctx = observability.WithBrokerLabels(ctx, broker) | ||
|
|
||
| ctx, span := h.tracer.Start(ctx, tracing.TriggerMessagingDestination(triggerRef.NamespacedName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why both this and line 280?
| if subscriberURI == nil { | ||
| // Record the event count. | ||
| writer.WriteHeader(http.StatusNotFound) | ||
| _ = h.reporter.ReportEventCount(reportArgs, http.StatusNotFound) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why stop recording this metric?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was discussed on the google doc, the idea is that it can be derived from the dispatch duration histogram (which implicitly has a total count)
Since we are instrumenting the handler with otel as well, there is the http.server.request.duration histogram as well, so rejected/invalid events can be found from the difference between the two
pkg/broker/ingress/server_manager.go
Outdated
|
|
||
| func NewServerManager(ctx context.Context, logger *zap.Logger, cmw configmap.Watcher, httpPort, httpsPort int, handler *Handler) (*eventingtls.ServerManager, error) { | ||
| func NewServerManager( | ||
| ctx context.Context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have trailing whitespace here:
| ctx context.Context, | |
| ctx context.Context, |
pkg/broker/ingress/server_manager.go
Outdated
| otelHandler := otelhttp.NewHandler(handler, "broker.ingress", | ||
| otelhttp.WithMeterProvider(meterProvider), | ||
| otelhttp.WithTracerProvider(traceProvider), | ||
| otelhttp.WithFilter(func(r *http.Request) bool { | ||
| return !network.IsKubeletProbe(r) | ||
| }), | ||
| otelhttp.WithPropagators(tracing.DefaultTextMapPropagator()), | ||
| otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string { | ||
| if r.URL.Path == "" { | ||
| return r.Method + " /" | ||
| } | ||
| return fmt.Sprintf("%s %s", r.Method, r.URL.Path) | ||
| }), | ||
|
|
||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems very similar to the code in filter. It would be great to have a common library function for setting this up, unless there are differences I'm missing.
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
Signed-off-by: Calum Murray <[email protected]>
Co-authored-by: Christoph Stäbler <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @Cali0707 for working on this 💪
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Cali0707, creydr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test reconciler-tests |
|
/unhold |
Fixes #8632 #8631
Proposed Changes
Release Note