jhuan31 commented on issue #840:  ZOOKEEPER-3143 Pluggable metrics system for 
ZooKeeper - Data Collection on Server
URL: https://github.com/apache/zookeeper/pull/840#issuecomment-471630416
 
 
   @eolivelli Since you don't think my questions are stupid, so here comes more 
:)
   
   Could you please give a scenario that a static ServerMetrics variable would 
cause trouble? If we default the static variable to NULL_METRICS then nothing 
would happen before the main Zookeeper thread starts the metric provider and 
sets the static variable to the right instance. After the static variable is 
set correctly, then the metrics will be reported correctly. Same behavior as 
the non-static case. 
   
   The reason we are cautious about switching to non-static serverMetrics is 
that we have so many metrics and we need to change the constructor or 
initialization logic for all classes that report metrics and classes along the 
invocation chain from the main thread. It's messy and error-prone. For example, 
in this change, the serverMetrics for watchManager is not set. The unit test 
will pass because it is set in the tests. But it is not set in the regular 
execution path.
   
   Another concern is, if we want to report metrics in a static function, how 
can it get hold of the serverMetrics instance?   
   
   Thanks!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to