-
Notifications
You must be signed in to change notification settings - Fork 460
fix: reuse global TracerProvider to avoid memory leak #5540
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
|
Hi @mweibel. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
I think @nawazkh did some work with tracing some time ago - pinging for visibility. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5540 +/- ##
==========================================
- Coverage 52.93% 52.86% -0.07%
==========================================
Files 272 272
Lines 29485 29474 -11
==========================================
- Hits 15607 15582 -25
- Misses 13061 13080 +19
+ Partials 817 812 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| return nil, err | ||
| } | ||
| opts.TracingProvider = azotel.NewTracingProvider(otelTP, nil) | ||
| opts.TracingProvider = azotel.NewTracingProvider(otel.GetTracerProvider(), nil) |
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 these reflect changing things that were first introduced in 1.18? As far as I can tell these changes were introduced in the v1.17.0 release:
cc @nojnhuh
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.
That PR only exists for 1.18 not backported AFAICT: abd8819
I don't really know if this is all totally "correct" or "the right way to do things"
Turns out it is neither. This looks much better! I can still see the traces.
/lgtm
|
LGTM label has been added. Git tree hash: ae3e77ebeba255197172487dd01e450f416073ce
|
|
/cherry-pick release-1.18 |
|
@nojnhuh: once the present PR merges, I will cherry-pick it on top of In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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.
/lgtm
I tested with tilt and traces are still showing up.
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.
/ok-to-test
😄
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nojnhuh 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 |
|
@nojnhuh: new pull request created: #5544 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@nojnhuh: new pull request created: #5545 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/kind bug
What this PR does / why we need it:
Fixes a memory leak occurring since v1.18.0 by reusing the global tracer provider instead of re-instantiating it many times (for each request basicly). This also ensures tracing provider is set to a valid value only when
enableTracingis set.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #5410
Special notes for your reviewer:
Global TraceProvider is set in:
cluster-api-provider-azure/pkg/ot/traces.go
Lines 37 to 42 in b32f0c6
Which is called in main:
cluster-api-provider-azure/main.go
Lines 354 to 359 in b32f0c6
It would be great if somebody could ensure tracing still works as intended - I did enable tracing to verify it works and it looks okay to me but I haven't verified it in great detail.
TODOs:
Release note: