@Override public TimeSeriesMetricDeltaSet apply(Context ctx) { return metric_.apply(ctx) .map(p -> MetricName.valueOf(p.getPath())) .map(group_.getTSDelta(ctx)::findMetric) .orElseGet(TimeSeriesMetricDeltaSet::new); }
private static void render_(StringBuilder out, String indent, MetricName metric, MetricValue value) { out .append(indent) .append(metric.configString()) .append(" = ") .append(value.toString()) .append('\n'); }
public boolean match(MetricName m) { return metric.match(m.getPath()); }
private TimeSeriesCollection transform_(Context<MutableTimeSeriesCollectionPair> ctx) { final MutableTimeSeriesCollection ts_data = ctx.getTSData().getCurrentCollection(); final Map<MetricName, MetricValue> metrics = metrics_.entrySet().stream() .map(name_value -> { return name_value.getKey().apply(ctx).map(name -> SimpleMapEntry.create(name, name_value.getValue())); }) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty)) .map(path_value -> SimpleMapEntry.create(MetricName.valueOf(path_value.getKey().getPath()), path_value.getValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); group_.getTSDelta(ctx).stream() .map(TimeSeriesValue::getGroup) .forEach((grp) -> ts_data.addMetrics(grp, metrics)); return ts_data; }
@Override public StringBuilder configString() { return new StringBuilder() .append(getGroup().configString()) .append(" ") .append(getMetric().configString()); } }
@Override public TimeSeriesMetricFilter getNameFilter() { final PathMatcher metricMatcher = new PathMatcher(metric_.getPath().stream() .map(PathMatcher.LiteralNameMatch::new) .collect(Collectors.toList())); return new TimeSeriesMetricFilter() .withMetric(new MetricMatcher(group_.getPathMatcher(), metricMatcher)); }
return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromBoolean((Boolean)attrObj))); return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromNumberValue((Number)attrObj))); return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromStrValue((String)attrObj)));
return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromBoolean((Boolean)attrObj))); return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromNumberValue((Number)attrObj))); return Stream.of(SimpleMapEntry.create(MetricName.valueOf(attrPath), MetricValue.fromStrValue((String)attrObj)));