/** * Creates sample with the timestamp and data source values supplied * in the argument string and stores sample in the corresponding RRD. * This method is just a shortcut for: * <pre> * set(timeAndValues); * update(); * </pre> * * @param timeAndValues String made by concatenating sample timestamp with corresponding * data source values delmited with colons. For example:<br> * <code>1005234132:12.2:35.6:U:24.5</code><br> * <code>NOW:12.2:35.6:U:24.5</code> * @throws java.io.IOException Thrown in case of I/O error. */ public void setAndUpdate(String timeAndValues) throws IOException { set(timeAndValues); update(); }
/** * <p>Creates sample with the timestamp and data source values supplied * in the argument string and stores sample in the corresponding RRD. * This method is just a shortcut for:</p> * <pre> * set(timeAndValues); * update(); * </pre> * * @param timeAndValues String made by concatenating sample timestamp with corresponding * data source values delmited with colons. For example:<br> * <code>1005234132:12.2:35.6:U:24.5</code><br> * <code>NOW:12.2:35.6:U:24.5</code> * @throws IOException Thrown in case of I/O error. */ public void setAndUpdate(String timeAndValues) throws IOException { set(timeAndValues); update(); }
@Override public void run() { try { long time = System.currentTimeMillis() / 1000; synchronized (statSample) { statSample.setTime(time); statSample.setValues(handler.triples); statSample.update(); } } catch (Exception e) { log.warn("could not update statistics database: {}", e.getMessage()); } } }
@Override public void run() { try { long time = System.currentTimeMillis() / 1000; synchronized (statSample) { statSample.setTime(time); statSample.setValues(handler.triples); statSample.update(); } } catch (Exception e) { log.warn("could not update statistics database: {}", e.getMessage()); } } }
private void updateSample(long now, double val) throws IOException { LOGGER.debug( "Sample time is [{}], updating metric [{}] with value [{}]", MetricsUtil.getCalendarTime(now), mbeanName, val); sample.setTime(now); sample.setValue(rrdDataSourceName, val); sample.update(); }
public void commit(JrdsSample sample) { RrdDb rrdDb = null; try { rrdDb = factory.getRrd(getPath()); Sample onesample = rrdDb.createSample(sample.getTime().getTime() / 1000); for(Map.Entry<String, Number> e: sample.entrySet()) { onesample.setValue(e.getKey(), e.getValue().doubleValue()); } if(p.getNamedLogger().isDebugEnabled()) log(Level.DEBUG, "%s", onesample.dump()); onesample.update(); } catch (IOException e) { log(Level.ERROR, e, "Error while collecting: %s", e.getMessage()); } finally { if(rrdDb != null) factory.releaseRrd(rrdDb); } }
protected void flushStatus() { if (transactions > 0) { try { Sample sample = db.createSample(endInterval); if (transactionsEnabled) { sample.setValue("transactions!", transactions); } if (minEnabled) { sample.setValue("min", min); } if (maxEnabled) { sample.setValue("max", max); } if (averageEnabled) { double value = total / (double) transactions; sample.setValue("average", value); } sample.update(); } catch (IOException e) { throw new EtmException(e); } } }
Sample sample = rrdDb.createSample(t); sample.setValue("a", Math.sin(t / 3000.0) * 50 + 50); sample.update();
sample.setValue("shade", shadeSource.getValue()); log.println(sample.dump()); sample.update(); t += RANDOM.nextDouble() * MAX_STEP + 1; if (((++n) % 1000) == 0) {