@PostConstruct
    public void init() {
        log.debug("Registering JVM gauges");
        metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
        metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
        metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
        metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
        metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(getPlatformMBeanServer()));
        metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet());
        metricRegistry.register(PROP_METRIC_REG_OS, new OperatingSystemGaugeSet(getOperatingSystemMXBean()));

        if (jhipsterProperties.getMetrics().getJmx().isEnabled()) {
            log.debug("Initializing Metrics JMX reporting");
            JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
            jmxReporter.start();
        }
        if (jhipsterProperties.getMetrics().getLogs().isEnabled()) {
            log.info("Initializing Metrics Log reporting");
            Marker metricsMarker = MarkerFactory.getMarker("metrics");
            final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
                .outputTo(LoggerFactory.getLogger("metrics"))
                .markWith(metricsMarker)
                .convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.MILLISECONDS)
                .build();
            reporter.start(jhipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
        }
    }
@ PostConstruct public void init ( ) { log . debug ( "Registering JVM gauges" ) ; metricRegistry . register ( PROP_METRIC_REG_JVM_MEMORY , new MemoryUsageGaugeSet ( ) ) ; metricRegistry . register ( PROP_METRIC_REG_JVM_GARBAGE , new GarbageCollectorMetricSet ( ) ) ; metricRegistry . register ( PROP_METRIC_REG_JVM_THREADS , new ThreadStatesGaugeSet ( ) ) ; metricRegistry . register ( PROP_METRIC_REG_JVM_FILES , new FileDescriptorRatioGauge ( ) ) ; metricRegistry . register ( PROP_METRIC_REG_JVM_BUFFERS , new BufferPoolMetricSet ( getPlatformMBeanServer ( ) ) ) ; metricRegistry . register ( PROP_METRIC_REG_JVM_ATTRIBUTE_SET , new JvmAttributeGaugeSet ( ) ) ; metricRegistry . register ( PROP_METRIC_REG_OS , new OperatingSystemGaugeSet ( getOperatingSystemMXBean ( ) ) ) ; if ( jhipsterProperties . getMetrics ( ) . getJmx ( ) . isEnabled ( ) ) { log . debug ( "Initializing Metrics JMX reporting" ) ; JmxReporter jmxReporter = JmxReporter . forRegistry ( metricRegistry ) . build ( ) ; jmxReporter . start ( ) ; } if ( jhipsterProperties . getMetrics ( ) . getLogs ( ) . isEnabled ( ) ) { log . info ( "Initializing Metrics Log reporting" ) ; Marker metricsMarker = MarkerFactory . getMarker ( "metrics" ) ; final Slf4jReporter reporter = Slf4jReporter . forRegistry ( metricRegistry ) . outputTo ( LoggerFactory . getLogger ( "metrics" ) ) . markWith ( metricsMarker ) . convertRatesTo ( TimeUnit . SECONDS ) . convertDurationsTo ( TimeUnit . MILLISECONDS ) . build ( ) ; reporter . start ( jhipsterProperties . getMetrics ( ) . getLogs ( ) . getReportFrequency ( ) , TimeUnit . SECONDS ) ; } }
Init commons metrics