com.codahale.metrics.jmx.ObjectNameFactory Java Examples

The following examples show how to use com.codahale.metrics.jmx.ObjectNameFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CodahaleMetricsProvider.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static void setupJMXReporter(Bus b, MetricRegistry reg) {
    InstrumentationManager im = b.getExtension(InstrumentationManager.class);
    if (im != null) {
        JmxReporter reporter = JmxReporter.forRegistry(reg).registerWith(im.getMBeanServer())
            .inDomain("org.apache.cxf")
            .createsObjectNamesWith(new ObjectNameFactory() {
                public ObjectName createName(String type, String domain, String name) {
                    try {
                        return new ObjectName(name);
                    } catch (MalformedObjectNameException e) {
                        throw new RuntimeException(e);
                    }
                }
            })
            .build();
        reporter.start();
    }
}
 
Example #2
Source File: JmxMetricsReporter.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public Builder createsObjectNamesWith(ObjectNameFactory onFactory) {
  if(onFactory == null) {
    throw new IllegalArgumentException("null objectNameFactory");
  }
  this.objectNameFactory = onFactory;
  return this;
}
 
Example #3
Source File: JmxMetricsReporter.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JmxListener(MBeanServer mBeanServer, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit,
                    ObjectNameFactory objectNameFactory, String tag) {
  this.mBeanServer = mBeanServer;
  this.name = name;
  this.filter = filter;
  this.rateUnit = rateUnit;
  this.durationUnit = durationUnit;
  this.registered = new ConcurrentHashMap<>();
  this.objectNameFactory = objectNameFactory;
  this.tag = tag;
  this.exp = Query.eq(Query.attr(INSTANCE_TAG), Query.value(tag));
}
 
Example #4
Source File: JmxMetricsReporter.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JmxMetricsReporter(MBeanServer mBeanServer,
                           String domain,
                           MetricRegistry registry,
                           MetricFilter filter,
                           TimeUnit rateUnit,
                           TimeUnit durationUnit,
                           ObjectNameFactory objectNameFactory,
                           String tag) {
  this.registry = registry;
  this.listener = new JmxListener(mBeanServer, domain, filter, rateUnit, durationUnit, objectNameFactory, tag);
}