org.apache.hadoop.metrics2.impl.MsInfo Java Examples
The following examples show how to use
org.apache.hadoop.metrics2.impl.MsInfo.
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: HadoopTimelineMetricsSink.java From ambari-metrics with Apache License 2.0 | 6 votes |
@InterfaceAudience.Private public void appendPrefix(MetricsRecord record, StringBuilder sb) { String contextName = record.context(); Collection<MetricsTag> tags = record.tags(); if (useTagsMap.containsKey(contextName)) { Set<String> useTags = useTagsMap.get(contextName); for (MetricsTag t : tags) { if (useTags == null || useTags.contains(t.name())) { // the context is always skipped here because it is always added // the hostname is always skipped to avoid case-mismatches // from different DNSes. if (t.info() != MsInfo.Context && t.info() != MsInfo.Hostname && t.value() != null) { sb.append('.').append(t.name()).append('=').append(t.value()); } } } } }
Example #2
Source File: GangliaSink30.java From hadoop with Apache License 2.0 | 6 votes |
@InterfaceAudience.Private public void appendPrefix(MetricsRecord record, StringBuilder sb) { String contextName = record.context(); Collection<MetricsTag> tags = record.tags(); if (useTagsMap.containsKey(contextName)) { Set<String> useTags = useTagsMap.get(contextName); for (MetricsTag t : tags) { if (useTags == null || useTags.contains(t.name())) { // the context is always skipped here because it is always added // the hostname is always skipped to avoid case-mismatches // from different DNSes. if (t.info() != MsInfo.Context && t.info() != MsInfo.Hostname && t.value() != null) { sb.append('.').append(t.name()).append('=').append(t.value()); } } } } }
Example #3
Source File: TestMetricsAnnotations.java From hadoop with Apache License 2.0 | 6 votes |
@Test public void testHybrid() { HybridMetrics metrics = new HybridMetrics(); MetricsSource source = MetricsAnnotations.makeSource(metrics); assertSame(metrics, source); metrics.C0.incr(); MetricsRecordBuilder rb = getMetrics(source); MetricsCollector collector = rb.parent(); verify(collector).addRecord("foo"); verify(collector).addRecord("bar"); verify(collector).addRecord(info("HybridMetrics", "HybridMetrics")); verify(rb).setContext("foocontext"); verify(rb).addCounter(info("C1", "C1 desc"), 1); verify(rb).setContext("barcontext"); verify(rb).addGauge(info("G1", "G1 desc"), 1); verify(rb).add(tag(MsInfo.Context, "hybrid")); verify(rb).addCounter(info("C0", "C0 desc"), 1); verify(rb).addGauge(info("G0", "G0"), 0); }
Example #4
Source File: GangliaSink30.java From big-c with Apache License 2.0 | 6 votes |
@InterfaceAudience.Private public void appendPrefix(MetricsRecord record, StringBuilder sb) { String contextName = record.context(); Collection<MetricsTag> tags = record.tags(); if (useTagsMap.containsKey(contextName)) { Set<String> useTags = useTagsMap.get(contextName); for (MetricsTag t : tags) { if (useTags == null || useTags.contains(t.name())) { // the context is always skipped here because it is always added // the hostname is always skipped to avoid case-mismatches // from different DNSes. if (t.info() != MsInfo.Context && t.info() != MsInfo.Hostname && t.value() != null) { sb.append('.').append(t.name()).append('=').append(t.value()); } } } } }
Example #5
Source File: TestMetricsAnnotations.java From big-c with Apache License 2.0 | 6 votes |
@Test public void testHybrid() { HybridMetrics metrics = new HybridMetrics(); MetricsSource source = MetricsAnnotations.makeSource(metrics); assertSame(metrics, source); metrics.C0.incr(); MetricsRecordBuilder rb = getMetrics(source); MetricsCollector collector = rb.parent(); verify(collector).addRecord("foo"); verify(collector).addRecord("bar"); verify(collector).addRecord(info("HybridMetrics", "HybridMetrics")); verify(rb).setContext("foocontext"); verify(rb).addCounter(info("C1", "C1 desc"), 1); verify(rb).setContext("barcontext"); verify(rb).addGauge(info("G1", "G1 desc"), 1); verify(rb).add(tag(MsInfo.Context, "hybrid")); verify(rb).addCounter(info("C0", "C0 desc"), 1); verify(rb).addGauge(info("G0", "G0"), 0); }
Example #6
Source File: TestMetricsAnnotations.java From hadoop with Apache License 2.0 | 5 votes |
@Test public void testClasses() { MetricsRecordBuilder rb = getMetrics( MetricsAnnotations.makeSource(new MyMetrics3())); MetricsCollector collector = rb.parent(); verify(collector).addRecord(info("MyMetrics3", "My metrics")); verify(rb).add(tag(MsInfo.Context, "foo")); }
Example #7
Source File: TestMetricsAnnotations.java From big-c with Apache License 2.0 | 5 votes |
@Test public void testClasses() { MetricsRecordBuilder rb = getMetrics( MetricsAnnotations.makeSource(new MyMetrics3())); MetricsCollector collector = rb.parent(); verify(collector).addRecord(info("MyMetrics3", "My metrics")); verify(rb).add(tag(MsInfo.Context, "foo")); }
Example #8
Source File: MetricsRegistry.java From hadoop with Apache License 2.0 | 2 votes |
/** * Set the metrics context tag * @param name of the context * @return the registry itself as a convenience */ public MetricsRegistry setContext(String name) { return tag(MsInfo.Context, name, true); }
Example #9
Source File: MetricsRegistry.java From big-c with Apache License 2.0 | 2 votes |
/** * Set the metrics context tag * @param name of the context * @return the registry itself as a convenience */ public MetricsRegistry setContext(String name) { return tag(MsInfo.Context, name, true); }
Example #10
Source File: DynamicMetricsRegistry.java From hbase with Apache License 2.0 | 2 votes |
/** * Set the metrics context tag * @param name of the context * @return the registry itself as a convenience */ public DynamicMetricsRegistry setContext(String name) { return tag(MsInfo.Context, name, true); }