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

How to use
getType
method
in
org.opennms.newts.api.Sample

Best Java code snippets using org.opennms.newts.api.Sample.getType (Showing top 5 results out of 315)

origin: OpenNMS/newts

private static boolean isNaN(Sample sample) {
  return (sample.getType() == MetricType.GAUGE) && Double.isNaN(sample.getValue().doubleValue());
}
origin: OpenNMS/newts

@Override
public String toString() {
  return String.format(
      "%s[timestamp=%s, context=%s, resource=%s, name=%s, type=%s, value=%s]",
      getClass().getSimpleName(),
      getTimestamp(),
      getContext(),
      getResource(),
      getName(),
      getType(),
      getValue());
}
origin: OpenNMS/newts

@Override
public Row<Sample> next() {
  if (!hasNext()) throw new NoSuchElementException();
  Row<Sample> working = m_input.next();
  Row<Sample> result = new Row<>(working.getTimestamp(), working.getResource());
  for (String metricName : m_metrics) {
    Sample sample = working.getElement(metricName);
    if (sample == null) {
      continue;
    }
    // Use rate as result if one of counter types, else pass through as-is.
    result.addElement(COUNTERS.contains(sample.getType()) ? getRate(sample) : sample);
    m_prevSamples.put(sample.getName(), sample);
  }
  return result;
}
origin: OpenNMS/newts

@Override
public Sample call(Sample s) {
  Timestamp oldTs = s.getTimestamp();
  Timestamp newTs = Timestamp.fromEpochMillis(m_timeoffset + Math.round(oldTs.asMillis()/m_timescaleFactor));
  return new Sample(newTs, s.getResource(), s.getName(), s.getType(), s.getValue());
}

origin: OpenNMS/newts

  @Override
  public String call(List<Sample> samples) {
    JSONBuilder bldr = new JSONBuilder();
    for(Sample sample : samples) {
      if (isNaN(sample)) continue;
      //System.err.println("Importing: " + sample);
      bldr.newObject();
      bldr.attr("timestamp", sample.getTimestamp().asMillis());
      bldr.attr("resource", sample.getResource().getId());
      bldr.attr("name", sample.getName());
      bldr.attr("type", sample.getType().name());
      if (sample.getType() == MetricType.GAUGE) {
        bldr.attr("value", sample.getValue().doubleValue());
      } else {
        bldr.attr("value", sample.getValue().longValue());
      }
    }
    return bldr.toString();
  }
};
org.opennms.newts.apiSamplegetType

Popular methods of Sample

  • <init>
  • getName
  • getResource
  • getTimestamp
  • getValue
  • getContext
  • getAttributes
  • compareSample
  • display
  • getData
  • getFirst
  • getId
  • getFirst,
  • getId,
  • getLabel,
  • getMatrix,
  • getSecond,
  • getStringList,
  • getUserName,
  • intmethod,
  • isALive

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • getExternalFilesDir (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • ImageIO (javax.imageio)
  • JButton (javax.swing)
  • From CI to AI: The AI layer in your organization
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