/** * Get a view of the child {@link gobblin.metrics.MetricContext}s as a {@link com.google.common.collect.ImmutableMap}. * @return {@link com.google.common.collect.ImmutableMap} of * child {@link gobblin.metrics.MetricContext}s keyed by their names. */ public Map<String, MetricContext> getChildContextsAsMap() { return this.innerMetricContext.getChildContextsAsMap(); }
private boolean removeChildrenMetrics(String name) { boolean removed = true; for (MetricContext child : getChildContextsAsMap().values()) { if (!child.remove(name)) { removed = false; } } return removed; }
@Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("InnerMetricContext Name: "); stringBuilder.append(this.name); if (this.getParent().isPresent()) { stringBuilder.append(", Parent Name: "); stringBuilder.append(this.getParent().get().getName()); } else { stringBuilder.append(", No Parent Context"); } stringBuilder.append(", Number of Children: "); stringBuilder.append(this.getChildContextsAsMap().size()); stringBuilder.append(", Tags: "); stringBuilder.append(Joiner.on(", ").withKeyValueSeparator(" : ").useForNull("NULL").join(this.getTagMap())); return stringBuilder.toString(); } }