@Override public String toString() { return '{' + getTagString() + '}'; }
public String getTagString() { return stream() .sorted(Comparator.comparing(Map.Entry::getKey)) .map((entry) -> tag_as_string_(entry.getKey(), entry.getValue())) .collect(Collectors.joining(", ")); }
public boolean isEmpty() { return asMap().isEmpty(); } public boolean contains(String tag) { return tags_.containsKey(tag); }
public static Tags valueOf(Map<String, MetricValue> tags) { return valueOf(tags.entrySet().stream()); }
private static GroupName calculate_new_name_(GroupName oldname, Map<String, MetricValue> tagged_values) { return GroupName.valueOf(oldname.getPath(), Stream.concat( oldname.getTags().stream().filter((Map.Entry<String, MetricValue> entry) -> !tagged_values.keySet().contains(entry.getKey())), tagged_values.entrySet().stream())); }
@Override public int compareTo(GroupName o) { if (o == null) return 1; int cmp = 0; if (cmp == 0) cmp = getPath().compareTo(o.getPath()); if (cmp == 0) cmp = getTags().compareTo(o.getTags()); return cmp; }
@Override public TimeSeriesMetricDeltaSet apply(Context ctx) { return new TimeSeriesMetricDeltaSet( expr_.mapCombine( expr -> expr.apply(ctx).streamAsMap() .map(t -> t.getKey()), group -> group.getTSDelta(ctx).asMap().values().stream() .flatMap(Collection::stream) .map(tsv -> tsv.getGroup()) .map(g -> g.getTags())) .map(tags -> SimpleMapEntry.create(tags, tags.getTag(tag_))) .map(tag_optval -> tag_optval.getValue().map(v -> SimpleMapEntry.create(tag_optval.getKey(), v))) .flatMap(opt -> opt.map(Stream::of).orElseGet(Stream::empty))); }
public boolean isEmpty() { return asMap().isEmpty(); } public boolean contains(String tag) { return tags_.containsKey(tag); }
public String getTagString() { return stream() .sorted(Comparator.comparing(Map.Entry::getKey)) .map((entry) -> tag_as_string_(entry.getKey(), entry.getValue())) .collect(Collectors.joining(", ")); }
public static Tags valueOf(Map<String, MetricValue> tags) { return valueOf(tags.entrySet().stream()); }
@Override public int compareTo(GroupName o) { if (o == null) return 1; int cmp = 0; if (cmp == 0) cmp = getPath().compareTo(o.getPath()); if (cmp == 0) cmp = getTags().compareTo(o.getTags()); return cmp; }
public Stream<Map.Entry<String, MetricValue>> stream() { return asMap().entrySet().stream(); }
/** * Reduce the list of tags, to only those specified in the argument set. * @param tag_names The tag names to retain. * @return A new instance of tags, which contains only tags mentioned in the argument set. */ public Tags filter(Set<String> tag_names) { return Tags.valueOf(tags_.entrySet().stream() .filter(entry -> tag_names.contains(entry.getKey()))); }
@Override public String toString() { return '{' + getTagString() + '}'; }
public Iterator<Map.Entry<String, MetricValue>> iterator() { return asMap().entrySet().iterator(); }
/** * Reduce the list of tags, to only those specified in the argument set. * @param tag_names The tag names to retain. * @return A new instance of tags, which contains only tags mentioned in the argument set. */ public Tags filter(Set<String> tag_names) { return Tags.valueOf(tags_.entrySet().stream() .filter(entry -> tag_names.contains(entry.getKey()))); }