Fix metrics context circular reference#1535
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1535 +/- ##
==========================================
- Coverage 83.85% 83.28% -0.56%
==========================================
Files 156 156
Lines 4908 4970 +62
==========================================
+ Hits 4115 4139 +24
- Misses 793 831 +38
|
|
@esigo - I have gone through the circular reference between |
| void *state = nullptr) | ||
| { | ||
| auto view_registry = meter_context_->GetViewRegistry(); | ||
| auto ctx = meter_context_.lock(); |
There was a problem hiding this comment.
Should we be checking if the ctx is valid here?
There was a problem hiding this comment.
makes sense. Shall we log something too?
There was a problem hiding this comment.
yes, I think we should log here if meter context is no more valid.
| InstrumentDescriptor &instrument_descriptor) | ||
| { | ||
| auto view_registry = meter_context_->GetViewRegistry(); | ||
| auto ctx = meter_context_.lock(); |
There was a problem hiding this comment.
Check if ctx is valid here before using?
Fixes #1534 (issue)
Changes
removed the cycles by using a
wrak_ptrto the context inmeter. Alsometer_collectorcan't haveweak_ptrto the context so I used raw pointer.For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes