chenBright commented on code in PR #3709:
URL: https://github.com/apache/brpc/pull/3709#discussion_r4467112100


##########
src/bvar/recorder.h:
##########
@@ -263,8 +263,10 @@ class IntRecorder : public Variable {
     }
 
 private:
-    shared_combiner_type    _combiner;
-    sampler_type* _sampler;
+    shared_combiner_type _combiner{std::make_shared<combiner_type>()};
+    // `_combiner` keeps this ID allocated for the lifetime of the recorder.
+    const detail::AgentId _agent_id{_combiner->agent_id()};

Review Comment:
   The layout change is intentional. Users rebuild brpc and its consumers with 
matching headers when upgrading, so the old-header/new-library scenario 
described here does not apply to our upgrade model. Moving the cached ID behind 
a shared indirection would reintroduce the dependent loads this optimization 
removes. We will retain the current implementation.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to