Java Code Examples for org.apache.hadoop.metrics2.MetricsTag#info()

The following examples show how to use org.apache.hadoop.metrics2.MetricsTag#info() . 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 vote down vote up
@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 vote down vote up
@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: GangliaSink30.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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 4
Source File: MetricsRecordImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override public String context() {
  // usually the first tag
  for (MetricsTag t : tags) {
    if (t.info() == MsInfo.Context) {
      return t.value();
    }
  }
  return DEFAULT_CONTEXT;
}
 
Example 5
Source File: MetricsRecordImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override public String context() {
  // usually the first tag
  for (MetricsTag t : tags) {
    if (t.info() == MsInfo.Context) {
      return t.value();
    }
  }
  return DEFAULT_CONTEXT;
}