@@ -0,0 +1,1362 @@
+package com.example.sling.metrics.reporter;%0A%0Aimport com.example.sling.metrics.service.MetricService;%0Aimport org.apache.felix.scr.annotations.*;%0Aimport org.osgi.service.component.ComponentContext;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A@Component(name = %22Metrics JMX Reporter%22, metatype = true)%0Apublic class JmxReporter %7B%0A%0A    private static final Logger LOG = LoggerFactory.getLogger(JmxReporter.class);%0A%0A    @Property(label = %22Enabled%22, boolValue = true, description = %22Should the JMX reporter be enabled%22)%0A    private static final String JMX_REPORTER_ENABLED = %22jmxReporter.enabled%22;%0A%0A    @Reference%0A    private MetricService metricService = null;%0A%0A    private com.codahale.metrics.JmxReporter reporter = null;%0A%0A    @Activate%0A    protected void activate(final ComponentContext context) %7B%0A        final boolean isEnabled = (Boolean) context.getProperties().get(JMX_REPORTER_ENABLED);%0A        LOG.info(%22Metrics JmxReporter is enabled: %5B%7B%7D%5D%22, isEnabled);%0A%0A        if(isEnabled && metricService.isEnabled()) %7B%0A            reporter = com.codahale.metrics.JmxReporter.forRegistry(metricService.getRegistry()).build();%0A            reporter.start();%0A        %7D%0A    %7D%0A%0A    @Deactivate%0A    protected void deactivate() %7B%0A        if(reporter != null) %7B%0A            reporter.stop();%0A            LOG.info(%22Metrics JmxReporter stopped%22);%0A        %7D%0A    %7D%0A%0A%7D%0A

add JMX reporter