You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2022/05/02 21:40:36 UTC
[GitHub] [phoenix] joshelser commented on a diff in pull request #1431: PHOENIX-6699 Phoenix metrics overwriting DefaultMetricsSystem in Regi…
joshelser commented on code in PR #1431:
URL: https://github.com/apache/phoenix/pull/1431#discussion_r863210369
##########
phoenix-core/src/main/java/org/apache/phoenix/monitoring/MetricUtil.java:
##########
@@ -38,4 +46,22 @@ public static MetricsStopWatch getMetricsStopWatch(boolean isRequestMetricsEnabl
return new MetricsStopWatch(true);
}
+ // We need to cover the case when JmxCacheBuster has just stopped the HBase metrics
+ // system, and not accidentally overwrite the DefaultMetricsSystem singleton.
+ // See PHOENIX-6699
+ public static boolean isDefaultMetricsInitialized() {
+ try {
+ MetricsSystemImpl metrics = (MetricsSystemImpl) DefaultMetricsSystem.instance();
+ Field prefixField = MetricsSystemImpl.class.getDeclaredField("prefix");
Review Comment:
> we could just to check if we are and RS/Master process, and skip the initialization, but I don't know a way to do that.
I'm not coming up with any static state that you could look at to try to determine if you're in the context of a RS or Master, shy of _hoping_ that the classpath client side doesnt' have the `HRegionServer.class` in it (or similar).
The other thing I thought of was looking at `RpcServer.getCurrentCall()`. Normally, there is a corresponding user RPC which would result in this returning the current RPC. But, this method would return empty during a compaction (e.g. updating Phoenix stats) where there is no active HBase Call.
Could we somehow separate the Phoenix client-side-only metrics from the execution pathway of the Phoenix server-side metrics? I imagine this is no easier to do.
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org