Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
W-6178055: Adding internal metric tracking number of registered mbean…
Browse files Browse the repository at this point in the history
…s (internal metrics). (#468)

* W-6174525: Include jmx_exporter via POM

https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07B0000006tymLIAQ/view

* W-6178055: Adding internal metric tracking number of registered mbeans (internal metrics).

https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07B0000006uQh4IAE/view
  • Loading branch information
Philip Liew authored and GitHub Enterprise committed Jun 3, 2019
1 parent bfef1b5 commit 840f627
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ArgusCore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>io.prometheus.jmx</groupId>
<artifactId>jmx_prometheus_javaagent</artifactId>
<version>${jmx.prometheus.version}</version>
</dependency>
<!-- BEGINSFDC specific dependencies -->
<dependency>
<groupId>com.salesforce.servicelibs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public static enum Counter {
THREADS("argus.jvm", "thread.used"),
PEAK_THREADS("argus.jvm", "thread.peak"),
DAEMON_THREADS("argus.jvm", "thread.daemon"),
MBEANSERVER_MBEAN_TOTAL("argus.jvm", "mbeanserver.mbean.total", MetricType.COUNTER),
METRIC_WRITES("argus.core", "metric.writes", MetricType.COUNTER),
ANNOTATION_WRITES("argus.core", "annotation.writes", MetricType.COUNTER),
ANNOTATION_DROPS_MAXSIZEEXCEEDED("argus.core", "annotation.drops.maxSizeExceeded", MetricType.COUNTER),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,12 @@ private void _updateJVMStatsCounters() {
case DAEMON_THREADS:
value = (double) ManagementFactory.getThreadMXBean().getDaemonThreadCount();
break;
case MBEANSERVER_MBEAN_TOTAL:
value = _mbeanServer.getMBeanCount().doubleValue();
Metric metric = _constructCounterKey(counter.getMetric(), Collections.<String, String>emptyMap());
metric.setUnits(units);
_metrics.computeIfAbsent(metric, k -> _getCounterMXBeanInstance(k, counter)).setValue(value);
continue;
default:
throw new IllegalArgumentException("Unexpected Counter: This should never happen");
} // end switch
Expand Down

0 comments on commit 840f627

Please sign in to comment.