-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[improve][broker] Reuse topic OpenTelemetry attributes #22876
[improve][broker] Reuse topic OpenTelemetry attributes #22876
Conversation
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, nice work @dragosvictor
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22876 +/- ##
============================================
- Coverage 73.57% 73.25% -0.33%
- Complexity 32624 32994 +370
============================================
Files 1877 1891 +14
Lines 139502 141935 +2433
Branches 15299 15565 +266
============================================
+ Hits 102638 103970 +1332
- Misses 28908 29939 +1031
- Partials 7956 8026 +70
Flags with carried forward coverage won't be shown. Click here to find out more.
|
(cherry picked from commit 5a8db36)
Fixes #22817
Motivation
Successive collections of OpenTelemetry metrics re-allocate all attribute sets related to a topic. Since topics are a high-cardinality object in Pulsar, this puts pressure on the GC. This PR proposes caching these attribute sets.
Modifications
TopicAttributes
andPersistentTopicAttributes
to store all attribute sets relevant for a topic.NonPersistentTopic
andPersistentTopic
objects. If OpenTelemetry is not enabled, these objects never get created, saving memory.OpenTelemetryTopicStats
to use the cached objects instead of re-allocating them every run.OpenTelemetryAttributes
, for a cleaner design.Verifying this change
This change is already covered by existing tests, such as
org.apache.pulsar.broker.stats.OpenTelemetryTopicStatsTest
.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: dragosvictor#31