com.codahale.metrics.JmxAttributeGauge Java Examples

The following examples show how to use com.codahale.metrics.JmxAttributeGauge. 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: AbstractJmxCache.java    From blueflood with Apache License 2.0 6 votes vote down vote up
public void instantiateYammerMetrics(Class klass, String scope, ObjectName nameObj) {
    String name = MetricRegistry.name(klass);
    if (scope != null) {
        name = MetricRegistry.name(name, scope);
    }
    MetricRegistry reg = Metrics.getRegistry();
    hitCount = reg.register(MetricRegistry.name(name, "Hit Count"),
            new JmxAttributeGauge(nameObj, "HitCount"));
    hitRate = reg.register(MetricRegistry.name(name, "Hit Rate"),
            new JmxAttributeGauge(nameObj, "HitRate"));
    loadCount = reg.register(MetricRegistry.name(name, "Load Count"),
            new JmxAttributeGauge(nameObj, "LoadCount"));
    missRate = reg.register(MetricRegistry.name(name, "Miss Rate"),
            new JmxAttributeGauge(nameObj, "MissRate"));
    requestCount = reg.register(MetricRegistry.name(name, "Request Count"),
            new JmxAttributeGauge(nameObj, "RequestCount"));
    totalLoadTime = reg.register(MetricRegistry.name(name, "Total Load Time"),
            new JmxAttributeGauge(nameObj, "TotalLoadTime"));
}
 
Example #2
Source File: IrisMetricSet.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
public JmxAttributeGauge jmx(ObjectName object, String attribute) {
   return new JmxAttributeGauge(object, attribute);
}
 
Example #3
Source File: IrisMetricSet.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
public JmxAttributeGauge jmx(String object, String attribute) throws MalformedObjectNameException {
   return jmx(new ObjectName(object), attribute);
}
 
Example #4
Source File: IrisMetricSet.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
public JmxAttributeGauge jmx(String name, ObjectName object, String attribute) {
   return register(name, jmx(object, attribute));
}
 
Example #5
Source File: IrisMetricSet.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
public JmxAttributeGauge jmx(String name, String object, String attribute) throws MalformedObjectNameException {
   return register(name, jmx(object, attribute));
}
 
Example #6
Source File: ZKShardLockManager.java    From blueflood with Apache License 2.0 4 votes vote down vote up
/**
 * Registers the different ZooKeeper metrics.
 */
private void registerMetrics(final ObjectName nameObj, MetricRegistry reg) {
    reg.register(MetricRegistry.name(ZKShardLockManager.class, "Lock Disinterested Time Millis"),
            new JmxAttributeGauge(nameObj, "LockDisinterestedTimeMillis"));
    reg.register(MetricRegistry.name(ZKShardLockManager.class, "Min Lock Hold Time Millis"),
            new JmxAttributeGauge(nameObj, "MinLockHoldTimeMillis"));
    reg.register(MetricRegistry.name(ZKShardLockManager.class, "Seconds Since Last Scavenge"),
            new JmxAttributeGauge(nameObj, "SecondsSinceLastScavenge"));

    reg.register(MetricRegistry.name(ZKShardLockManager.class, "Zk Connection Status"),
            new JmxAttributeGauge(nameObj, "ZkConnectionStatus") {
                @Override
                public Object getValue() {
                    Object val = super.getValue();
                    if (val.equals("connected")) {
                        return 1;
                    }
                    return 0;
                }
            });
    reg.register(MetricRegistry.name(ZKShardLockManager.class, "Held Shards"),
            new Gauge<Integer>() {
                @Override
                public Integer getValue() {
                    return getHeldShards().size();
                }
            });

    reg.register(MetricRegistry.name(ZKShardLockManager.class, "Unheld Shards"),
            new Gauge<Integer>() {
                @Override
                public Integer getValue() {
                    return getUnheldShards().size();
                }
            });
    reg.register(MetricRegistry.name(ZKShardLockManager.class, "Error Shards"),
            new Gauge<Integer>() {
                @Override
                public Integer getValue() {
                    return getErrorShards().size();
                }
            });
}