/** * Creates a new instance. */ public ConverterService() { converter = new MetricTimeSeriesConverter(); }
public ChronixUpdater(SolrClient solr, BlockingQueue<Record> records, Map<String, String> fieldToMetricTypeMapping, int batchSize, long flushInterval) { this.solr = solr; this.records = records; this.batchSize = batchSize; this.flushInterval = flushInterval; this.lastTS = System.nanoTime(); // far in the future ... converter = new MetricTimeSeriesConverter(); storage = new ChronixSolrStorage<>(batchSize, groupBy, reduce); if (fieldToMetricTypeMapping != null) { this.fieldToMetricTypeMapping.putAll(fieldToMetricTypeMapping); } //add the defaults this.fieldToMetricTypeMapping.put(FieldDictionary.RECORD_VALUE, RecordDictionary.METRIC); threadCount++; }
@Override public TimeSeries<Long, Double> from(BinaryTimeSeries binaryTimeSeries, long queryStart, long queryEnd) { //This is a hack MetricTimeSeries metricTimeSeries = new MetricTimeSeriesConverter().from(binaryTimeSeries, queryStart, queryEnd); TimeSeries<Long, Double> timeSeries = new TimeSeries<>(map(metricTimeSeries.points())); metricTimeSeries.getAttributesReference().forEach(timeSeries::addAttribute); return timeSeries; }
@Override public BinaryTimeSeries to(TimeSeries<Long, Double> timeSeries) { //-oo is represented through the first element that is null, hence if the size is one the time series is empty if (timeSeries.size() == 1) { LOGGER.info("Empty time series detected. {}", timeSeries); //Create a builder with the minimal required fields BinaryTimeSeries.Builder builder = new BinaryTimeSeries.Builder() .data(new byte[]{}) .start(0) .end(0); return builder.build(); } else { return new MetricTimeSeriesConverter().to(map(timeSeries)); } }
stream = detectGzip(stream); MetricTimeSeriesConverter converter = new MetricTimeSeriesConverter();