congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Sample.getTimestamp
Code IndexAdd Tabnine to your IDE (free)

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

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

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

/**
 * Construct a new {@link DriverAdapter}.
 * 
 * @param input
 *            cassandra driver {@link ResultSet}
 * @param metrics
 *            the set of result metrics to include; an empty set indicates that all metrics
 *            should be included
 */
DriverAdapter(Iterator<com.datastax.driver.core.Row> input, Set<String> metrics) {
  m_results = checkNotNull(input, "input argument");
  m_metrics = checkNotNull(metrics, "metrics argument");
  if (m_results.hasNext()) {
    Sample m = getNextSample();
    m_next = new Results.Row<>(m.getTimestamp(), m.getResource());
    addSample(m_next, m);
  }
}
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

@Override
public Results.Row<Sample> next() {
  if (!hasNext()) throw new NoSuchElementException();
  Results.Row<Sample> nextNext = null;
  while (m_results.hasNext()) {
    Sample m = getNextSample();
    if (m.getTimestamp().gt(m_next.getTimestamp())) {
      nextNext = new Results.Row<>(m.getTimestamp(), m.getResource());
      addSample(nextNext, m);
      break;
    }
    addSample(m_next, m);
  }
  try {
    return m_next;
  }
  finally {
    m_next = nextNext;
  }
}
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

if (intervalCeiling.lt(last.getTimestamp())) {
  break;
Timestamp lowerBound = last.getTimestamp();
if (lastIntervalCeiling != null && lastIntervalCeiling.gt(lowerBound)) {
  lowerBound = lastIntervalCeiling;
Timestamp upperBound = current.getTimestamp();
if (intervalCeiling.lt(upperBound)) {
  upperBound = intervalCeiling;
Duration elapsedBetweenSamples = current.getTimestamp().minus(last.getTimestamp());
origin: OpenNMS/newts

int ttl = m_ttl;
if (calculateTimeToLive) {
  ttl -= (int) (now.asSeconds() - m.getTimestamp().asSeconds());
  if (ttl <= 0) {
    LOG.debug("Skipping expired sample: {}", m);
    .value(SchemaConstants.F_PARTITION, m.getTimestamp().stepFloor(resourceShard).asSeconds())
    .value(SchemaConstants.F_RESOURCE, m.getResource().getId())
    .value(SchemaConstants.F_COLLECTED, m.getTimestamp().asMillis())
    .value(SchemaConstants.F_METRIC_NAME, m.getName())
    .value(SchemaConstants.F_VALUE, ValueType.decompose(m.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.apiSamplegetTimestamp

Popular methods of Sample

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

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • getSharedPreferences (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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