public static Timestamp fromDate(Date d) { return fromEpochMillis(d.getTime()); }
@Override protected Timestamp parse(String input) throws Exception { if (input.matches("^[\\d]+$")) { return Timestamp.fromEpochSeconds(Integer.valueOf(input)); } DateTime dateTime = parser.parseDateTime(input); return Timestamp.fromEpochMillis(dateTime.getMillis()); }
@Override protected Timestamp parse(String input) throws Exception { if (input.matches("^[\\d]+$")) { return Timestamp.fromEpochSeconds(Integer.valueOf(input)); } DateTime dateTime = parser.parseDateTime(input); return Timestamp.fromEpochMillis(dateTime.getMillis()); }
@Override protected Timestamp parse(String argument) throws NumberFormatException, CmdLineException { DateTimeFormatter parser = ISODateTimeFormat.dateTimeParser(); DateTime dateTime = parser.parseDateTime(argument); return Timestamp.fromEpochMillis(dateTime.getMillis()); }
private static Timestamp getTimestamp(com.datastax.driver.core.Row row) { return Timestamp.fromEpochMillis(row.getTimestamp(SchemaConstants.F_COLLECTED).getTime()); }
/** Perform simple query; Establishes only that we can go to the database without excepting. */ @Override protected Result check() throws Exception { m_repository.select(Context.DEFAULT_CONTEXT, new Resource("notreal"), Optional.of(Timestamp.fromEpochMillis(0)), Optional.of(Timestamp.fromEpochMillis(0))); return Result.healthy(); }
/** Perform simple query; Establishes only that we can go to the database without excepting. */ @Override protected Result check() throws Exception { m_repository.select(Context.DEFAULT_CONTEXT, new Resource("notreal"), Optional.of(Timestamp.fromEpochMillis(0)), Optional.of(Timestamp.fromEpochMillis(0))); return Result.healthy(); }
@Override @SuppressWarnings("rawtypes") public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { Timestamp timestamp = Timestamp.fromEpochMillis(clock.getTime()); List<Sample> samples = Lists.newArrayList(); for (Map.Entry<String, Gauge> entry : gauges.entrySet()) { reportGauge(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Counter> entry : counters.entrySet()) { reportCounter(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Histogram> entry : histograms.entrySet()) { reportHistogram(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Meter> entry : meters.entrySet()) { reportMeter(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Timer> entry : timers.entrySet()) { reportTimer(samples, timestamp, entry.getKey(), entry.getValue()); } this.repository.insert(samples); }
@Override @SuppressWarnings("rawtypes") public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { Timestamp timestamp = Timestamp.fromEpochMillis(clock.getTime()); List<Sample> samples = Lists.newArrayList(); for (Map.Entry<String, Gauge> entry : gauges.entrySet()) { reportGauge(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Counter> entry : counters.entrySet()) { reportCounter(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Histogram> entry : histograms.entrySet()) { reportHistogram(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Meter> entry : meters.entrySet()) { reportMeter(samples, timestamp, entry.getKey(), entry.getValue()); } for (Map.Entry<String, Timer> entry : timers.entrySet()) { reportTimer(samples, timestamp, entry.getKey(), entry.getValue()); } this.repository.insert(samples); }
@Override public FetchResults fetch(long start, long end, long step, int maxrows, Long interval, Long heartbeat, List<Source> sources, boolean relaxed) { final LateAggregationParams lag = getLagParams(step, interval, heartbeat); final Optional<Timestamp> startTs = Optional.of(Timestamp.fromEpochMillis(start)); final Optional<Timestamp> endTs = Optional.of(Timestamp.fromEpochMillis(end)); final Map<String, Object> constants = Maps.newHashMap(); final List<QueryResource> resources = new ArrayList<>();
@Override public FetchResults fetch(long start, long end, long step, int maxrows, Long interval, Long heartbeat, List<Source> sources, boolean relaxed) { final LateAggregationParams lag = getLagParams(step, interval, heartbeat); final Optional<Timestamp> startTs = Optional.of(Timestamp.fromEpochMillis(start)); final Optional<Timestamp> endTs = Optional.of(Timestamp.fromEpochMillis(end)); final Map<String, Object> constants = Maps.newHashMap();
@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()); }
Timestamp timestamp = Timestamp.fromEpochMillis(m_timeKeeper.getCurrentTime()); for (Entry<CollectionAttributeType, Number> entry : m_declarations.entrySet()) { CollectionAttributeType attrType = entry.getKey();
Timestamp timestamp = Timestamp.fromEpochMillis(m_timeKeeper.getCurrentTime()); for (Entry<CollectionAttributeType, Number> entry : m_declarations.entrySet()) { CollectionAttributeType attrType = entry.getKey();
@Override public Sample apply(SampleDTO input) { return new Sample( Timestamp.fromEpochMillis(input.getTimestamp()), input.getContext(), new Resource(input.getResource().getId(), wrapMap(input.getResource().getAttributes())), input.getName(), input.getType(), ValueType.compose(input.getValue(), input.getType()), input.getAttributes()); } };
@Override public Sample apply(SampleDTO input) { return new Sample( Timestamp.fromEpochMillis(input.getTimestamp()), input.getContext(), new Resource(input.getResource().getId(), wrapMap(input.getResource().getAttributes())), input.getName(), input.getType(), ValueType.compose(input.getValue(), input.getType()), input.getAttributes()); } };