2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.reporting;
10 import com.codahale.metrics.JmxReporter;
11 import com.codahale.metrics.MetricRegistry;
14 * Maintains metrics registry that is provided to reporters.
15 * At the moment only one reporter exists {@code JmxReporter}.
16 * More reporters can be added.
18 * The consumers of this class will only be interested in {@code MetricsRegistry}
19 * where metrics for that consumer gets stored.
21 public class MetricsReporter implements AutoCloseable {
23 private static final MetricRegistry METRICS_REGISTRY = new MetricRegistry();
24 private static final String DOMAIN = "org.opendaylight.controller.actor.metric";
25 private static final MetricsReporter INSTANCE = new MetricsReporter();
27 private final JmxReporter jmxReporter = JmxReporter.forRegistry(METRICS_REGISTRY).inDomain(DOMAIN).build();
29 private MetricsReporter() {
33 public static MetricsReporter getInstance() {
37 public MetricRegistry getMetricsRegistry() {
38 return METRICS_REGISTRY;