/** * Enrich the <code>fetchResults</code> with NaN values for all <code>sources</code> which do not have values in the <code>fetchResults</code>. * * @param fetchResults * @param sources */ public static void fillMissingValues(FetchResults fetchResults, List<Source> sources) { Objects.requireNonNull(fetchResults); Objects.requireNonNull(sources); final int rowCount = fetchResults.getTimestamps().length; for (Source eachSource : sources) { if (!fetchResults.getColumns().containsKey(eachSource.getLabel())) { fetchResults.getColumns().put(eachSource.getLabel(), createNaNArray(rowCount)); } } }
/** * Enrich the <code>fetchResults</code> with NaN values for all <code>sources</code> which do not have values in the <code>fetchResults</code>. * * @param fetchResults * @param sources */ public static void fillMissingValues(FetchResults fetchResults, List<Source> sources) { Objects.requireNonNull(fetchResults); Objects.requireNonNull(sources); final int rowCount = fetchResults.getTimestamps().length; for (Source eachSource : sources) { if (!fetchResults.getColumns().containsKey(eachSource.getLabel())) { fetchResults.getColumns().put(eachSource.getLabel(), createNaNArray(rowCount)); } } }
final String rrdFile = entry.getValue(); final String tempLabel = Integer.toString(++k); labelMap.put(tempLabel, source.getLabel());
final String rrdFile = entry.getValue(); final String tempLabel = Integer.toString(++k); labelMap.put(tempLabel, source.getLabel());
for (Source source : entry.getValue()) { Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
for (Source source : entry.getValue()) { Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
final double[] statistics = results.getColumns().get(source.getLabel()); if (statistics == null || statistics.length == 0) { LOG.warn("Statistic is empty: {}", source);
Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
@Override public Collection<Row<Measurement>> call() throws Exception { ResultDescriptor resultDescriptor = new ResultDescriptor(lag.getInterval()); for (Source source : listOfSources) { // Use the datasource as the metric name if set, otherwise use the name of the attribute final String metricName = source.getDataSource() != null ? source.getDataSource() : source.getAttribute(); final String name = source.getLabel(); final AggregationFunction fn = toAggregationFunction(source.getAggregation()); resultDescriptor.datasource(name, metricName, lag.getHeartbeat(), fn); resultDescriptor.export(name); } LOG.debug("Querying Newts for resource id {} with result descriptor: {}", newtsResourceId, resultDescriptor); Results<Measurement> results = m_sampleRepository.select(m_context, new Resource(newtsResourceId), start, end, resultDescriptor, Optional.of(Duration.millis(lag.getStep())), limitConcurrentAggregationsCallback); Collection<Row<Measurement>> rows = results.getRows(); LOG.debug("Found {} rows.", rows.size()); return rows; } };
@Override public Collection<Row<Measurement>> call() throws Exception { ResultDescriptor resultDescriptor = new ResultDescriptor(lag.getInterval()); for (Source source : listOfSources) { // Use the datasource as the metric name if set, otherwise use the name of the attribute final String metricName = source.getDataSource() != null ? source.getDataSource() : source.getAttribute(); final String name = source.getLabel(); final AggregationFunction fn = toAggregationFunction(source.getAggregation()); resultDescriptor.datasource(name, metricName, lag.getHeartbeat(), fn); resultDescriptor.export(name); } LOG.debug("Querying Newts for resource id {} with result descriptor: {}", newtsResourceId, resultDescriptor); Results<Measurement> results = m_sampleRepository.select(m_context, new Resource(newtsResourceId), start, end, resultDescriptor, Optional.of(Duration.millis(lag.getStep())), limitConcurrentAggregationsCallback); Collection<Row<Measurement>> rows = results.getRows(); LOG.debug("Found {} rows.", rows.size()); return rows; } };
final String rrdFile = entry.getValue(); final String tempLabel = Integer.toString(++k); labelMap.put(tempLabel, source.getLabel());
Utils.convertStringAttributesToConstants(source.getLabel(), resource.getStringPropertyAttributes(), constants);
final String rrdFile = entry.getValue(); final String tempLabel = Integer.toString(++k); labelMap.put(tempLabel, source.getLabel());
if (source.getResourceId() == null || source.getAttribute() == null || source.getLabel() == null || source.getAggregation() == null) { throw new ValidationException("Query source fields must be set: {}", source); if (labels.containsKey(source.getLabel())) { throw new ValidationException("Query source label '{}' conflict: source with that label is already defined.", source.getLabel()); } else { labels.put(source.getLabel(), "source");
if (source.getResourceId() == null || source.getAttribute() == null || source.getLabel() == null || source.getAggregation() == null) { throw new ValidationException("Query source fields must be set: {}", source); if (labels.containsKey(source.getLabel())) { throw new ValidationException("Query source label '{}' conflict: source with that label is already defined.", source.getLabel()); } else { labels.put(source.getLabel(), "source");
for (final Source source : request.getSources()) { if (source.getTransient()) { columns.remove(source.getLabel());
for (final Source source : request.getSources()) { if (source.getTransient()) { columns.remove(source.getLabel());