congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Sample.getValue
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using org.opennms.newts.api.Sample.getValue (Showing top 8 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 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

private Sample getRate(Sample sample) {
  ValueType<?> value = NAN;
  Sample previous = m_prevSamples.get(sample.getName());
  if (previous != null) {
    long elapsed = sample.getTimestamp().asSeconds() - previous.getTimestamp().asSeconds();
    try {
      value = new Gauge(sample.getValue().delta(previous.getValue()).doubleValue() / elapsed);
    } catch (ArithmeticException e) {
      value = NAN;
    }
  }
  return new Sample(sample.getTimestamp(), sample.getResource(), sample.getName(), GAUGE, value, sample.getAttributes());
}
origin: OpenNMS/newts

private int go(String[] args) {
  m_parser.setUsageWidth(80);
  try {
    m_parser.parseArgument(args);
  }
  catch (CmdLineException e) {
    System.err.println(e.getMessage());
    printUsage(System.err);
    return 1;
  }
  if (m_needsHelp) {
    printUsage(System.out);
    return 0;
  }
  if (m_resource == null || m_metric == null) {
    System.err.println("Missing required argument(s)");
    printUsage(System.err);
    return 1;
  }
  System.out.printf("timestamp,%s%n", m_metric);
  for (Results.Row<Sample> row : m_repository.select(Context.DEFAULT_CONTEXT, m_resource, timestamp(m_start), timestamp(m_end))) {
    System.out.printf("%s,%.2f%n", row.getTimestamp().asDate(), row.getElement(m_metric).getValue().doubleValue());
  }
  return 0;
}
origin: OpenNMS/newts

  ds.getHeartbeat(), current.getValue())
.accumlateAttrs(current.getAttributes());
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();
  }
};
origin: OpenNMS/newts

.value(SchemaConstants.F_COLLECTED, m.getTimestamp().asMillis())
.value(SchemaConstants.F_METRIC_NAME, m.getName())
.value(SchemaConstants.F_VALUE, ValueType.decompose(m.getValue()));
org.opennms.newts.apiSamplegetValue

Popular methods of Sample

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

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onRequestPermissionsResult (Fragment)
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JComboBox (javax.swing)
  • JPanel (javax.swing)
  • Option (scala)
  • Top plugins for Android Studio
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