MetricsSourceAdapter(String prefix, String name, String description, MetricsSource source, Iterable<MetricsTag> injectedTags, MetricsFilter recordFilter, MetricsFilter metricFilter, long jmxCacheTTL, boolean startMBeans) { this.prefix = checkNotNull(prefix, "prefix"); this.name = checkNotNull(name, "name"); this.source = checkNotNull(source, "source"); attrCache = Maps.newHashMap(); infoBuilder = new MBeanInfoBuilder(name, description); this.injectedTags = injectedTags; this.recordFilter = recordFilter; this.metricFilter = metricFilter; this.jmxCacheTTL = checkArg(jmxCacheTTL, jmxCacheTTL > 0, "jmxCacheTTL"); this.startMBeans = startMBeans; // Initialize to true so we always trigger update MBeanInfo cache the first // time calling updateJmxCache this.lastRecsCleared = true; }
MBeanAttributeInfo newAttrInfo(String name, String desc, String type) { return new MBeanAttributeInfo(getAttrName(name), type, desc, true, false, false); // read-only, non-is }
@Override public void gauge(MetricsInfo info, int value) { attrs.add(newAttrInfo(info, "java.lang.Integer")); }
@Override public void gauge(MetricsInfo info, long value) { attrs.add(newAttrInfo(info, "java.lang.Long")); }
@Override public void counter(MetricsInfo info, int value) { attrs.add(newAttrInfo(info, "java.lang.Integer")); }
MBeanAttributeInfo newAttrInfo(String name, String desc, String type) { return new MBeanAttributeInfo(getAttrName(name), type, desc, true, false, false); // read-only, non-is }
MetricsSourceAdapter(String prefix, String name, String description, MetricsSource source, Iterable<MetricsTag> injectedTags, MetricsFilter recordFilter, MetricsFilter metricFilter, long jmxCacheTTL, boolean startMBeans) { this.prefix = checkNotNull(prefix, "prefix"); this.name = checkNotNull(name, "name"); this.source = checkNotNull(source, "source"); attrCache = Maps.newHashMap(); infoBuilder = new MBeanInfoBuilder(name, description); this.injectedTags = injectedTags; this.recordFilter = recordFilter; this.metricFilter = metricFilter; this.jmxCacheTTL = checkArg(jmxCacheTTL, jmxCacheTTL > 0, "jmxCacheTTL"); this.startMBeans = startMBeans; // Initialize to true so we always trigger update MBeanInfo cache the first // time calling updateJmxCache this.lastRecsCleared = true; }
@Override public void counter(MetricsInfo info, long value) { attrs.add(newAttrInfo(info, "java.lang.Long")); }
MBeanAttributeInfo newAttrInfo(String name, String desc, String type) { return new MBeanAttributeInfo(getAttrName(name), type, desc, true, false, false); // read-only, non-is }
MetricsSourceAdapter(String prefix, String name, String description, MetricsSource source, Iterable<MetricsTag> injectedTags, MetricsFilter recordFilter, MetricsFilter metricFilter, long jmxCacheTTL, boolean startMBeans) { this.prefix = checkNotNull(prefix, "prefix"); this.name = checkNotNull(name, "name"); this.source = checkNotNull(source, "source"); attrCache = Maps.newHashMap(); infoBuilder = new MBeanInfoBuilder(name, description); this.injectedTags = injectedTags; this.recordFilter = recordFilter; this.metricFilter = metricFilter; this.jmxCacheTTL = checkArg(jmxCacheTTL, jmxCacheTTL > 0, "jmxCacheTTL"); this.startMBeans = startMBeans; // Initialize to true so we always trigger update MBeanInfo cache the first // time calling updateJmxCache this.lastRecsCleared = true; }
@Override public void gauge(MetricsInfo info, float value) { attrs.add(newAttrInfo(info, "java.lang.Float")); }
MBeanAttributeInfo newAttrInfo(String name, String desc, String type) { return new MBeanAttributeInfo(getAttrName(name), type, desc, true, false, false); // read-only, non-is }
MetricsSourceAdapter(String prefix, String name, String description, MetricsSource source, Iterable<MetricsTag> injectedTags, MetricsFilter recordFilter, MetricsFilter metricFilter, long jmxCacheTTL, boolean startMBeans) { this.prefix = checkNotNull(prefix, "prefix"); this.name = checkNotNull(name, "name"); this.source = checkNotNull(source, "source"); attrCache = Maps.newHashMap(); infoBuilder = new MBeanInfoBuilder(name, description); this.injectedTags = injectedTags; this.recordFilter = recordFilter; this.metricFilter = metricFilter; this.jmxCacheTTL = checkArg(jmxCacheTTL, jmxCacheTTL > 0, "jmxCacheTTL"); this.startMBeans = startMBeans; // Initialize to true so we always trigger update MBeanInfo cache the first // time calling updateJmxCache this.lastRecsCleared = true; }
@Override public void gauge(MetricsInfo info, double value) { attrs.add(newAttrInfo(info, "java.lang.Double")); }
MBeanAttributeInfo newAttrInfo(String name, String desc, String type) { return new MBeanAttributeInfo(getAttrName(name), type, desc, true, false, false); // read-only, non-is }