Tabnine Logo
MetricValue.getType
Code IndexAdd Tabnine to your IDE (free)

How to use
getType
method
in
co.cask.cdap.api.metrics.MetricValue

Best Java code snippets using co.cask.cdap.api.metrics.MetricValue.getType (Showing top 4 results out of 315)

origin: caskdata/cdap

 @Override
 protected MetricValues computeNext() {
  while (iterator.hasNext()) {
   Map.Entry<Map<String, String>, LoadingCache<String, AggregatedMetricsEmitter>> entry = iterator.next();
   Map<String, AggregatedMetricsEmitter> metricEmitters = entry.getValue().asMap();
   // +1 because we add extra metric about how many metric values did we emit in this context (see below)
   List<MetricValue> metricValues = Lists.newArrayListWithCapacity(metricEmitters.size() + 1);
   for (Map.Entry<String, AggregatedMetricsEmitter> emitterEntry : metricEmitters.entrySet()) {
    MetricValue metricValue = emitterEntry.getValue().emit();
    // skip increment by 0
    if (metricValue.getType() == MetricType.COUNTER && metricValue.getValue() == 0) {
     continue;
    }
    metricValues.add(metricValue);
   }
   if (metricValues.isEmpty()) {
    // skip if there are no metric values to send
    continue;
   }
   // number of emitted metrics
   metricValues.add(new MetricValue("metrics.emitted.count", MetricType.COUNTER, metricValues.size() + 1));
   LOG.trace("Emit metric {}", metricValues);
   return new MetricValues(entry.getKey(), timestamp, metricValues);
  }
  return endOfData();
 }
};
origin: co.cask.cdap/cdap-watchdog

 @Override
 protected MetricValues computeNext() {
  while (iterator.hasNext()) {
   Map.Entry<Map<String, String>, LoadingCache<String, AggregatedMetricsEmitter>> entry = iterator.next();
   Map<String, AggregatedMetricsEmitter> metricEmitters = entry.getValue().asMap();
   // +1 because we add extra metric about how many metric values did we emit in this context (see below)
   List<MetricValue> metricValues = Lists.newArrayListWithCapacity(metricEmitters.size() + 1);
   for (Map.Entry<String, AggregatedMetricsEmitter> emitterEntry : metricEmitters.entrySet()) {
    MetricValue metricValue = emitterEntry.getValue().emit();
    // skip increment by 0
    if (metricValue.getType() == MetricType.COUNTER && metricValue.getValue() == 0) {
     continue;
    }
    metricValues.add(metricValue);
   }
   if (metricValues.isEmpty()) {
    // skip if there are no metric values to send
    continue;
   }
   // number of emitted metrics
   metricValues.add(new MetricValue("metrics.emitted.count", MetricType.COUNTER, metricValues.size() + 1));
   LOG.trace("Emit metric {}", metricValues);
   return new MetricValues(entry.getKey(), timestamp, metricValues);
  }
  return endOfData();
 }
};
origin: caskdata/cdap

@Override
public void add(Collection<? extends MetricValues> metricValues) {
 List<CubeFact> facts = Lists.newArrayListWithCapacity(metricValues.size());
 for (MetricValues metricValue : metricValues) {
  String scope = metricValue.getTags().get(Constants.Metrics.Tag.SCOPE);
  List<Measurement> metrics = Lists.newArrayList();
  // todo improve this logic?
  for (MetricValue metric : metricValue.getMetrics()) {
   String measureName = (scope == null ? "system." : scope + ".") + metric.getName();
   MeasureType type = metric.getType() == MetricType.COUNTER ? MeasureType.COUNTER : MeasureType.GAUGE;
   metrics.add(new Measurement(measureName, type, metric.getValue()));
  }
  CubeFact fact = new CubeFact(metricValue.getTimestamp())
   .addDimensionValues(metricValue.getTags())
   .addMeasurements(metrics);
  facts.add(fact);
 }
 cube.get().add(facts);
}
origin: co.cask.cdap/cdap-watchdog

@Override
public void add(Collection<? extends MetricValues> metricValues) {
 List<CubeFact> facts = Lists.newArrayListWithCapacity(metricValues.size());
 for (MetricValues metricValue : metricValues) {
  String scope = metricValue.getTags().get(Constants.Metrics.Tag.SCOPE);
  List<Measurement> metrics = Lists.newArrayList();
  // todo improve this logic?
  for (MetricValue metric : metricValue.getMetrics()) {
   String measureName = (scope == null ? "system." : scope + ".") + metric.getName();
   MeasureType type = metric.getType() == MetricType.COUNTER ? MeasureType.COUNTER : MeasureType.GAUGE;
   metrics.add(new Measurement(measureName, type, metric.getValue()));
  }
  CubeFact fact = new CubeFact(metricValue.getTimestamp())
   .addDimensionValues(metricValue.getTags())
   .addMeasurements(metrics);
  facts.add(fact);
 }
 cube.get().add(facts);
}
co.cask.cdap.api.metricsMetricValuegetType

Popular methods of MetricValue

  • <init>
  • getName
  • getValue

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • requestLocationUpdates (LocationManager)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • JCheckBox (javax.swing)
  • JFileChooser (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now