if (!Environment.isCollector()) {
final SortedMap<Long, Double> gaugeValues = Repository.INSTANCE.getGaugeValues(start, end, role);
return "[" + Graphs.toJson(label, Graphs.DEFAULT_COLOR, aggregate(gaugeValues)) + "]";
}
final CollectorGaugeDataStore gaugeStore = IoCs.findOrCreateInstance(CollectorGaugeDataStore.class);
final Iterator<String> markers = gaugeStore.markers().iterator();
final StringBuilder builder = new StringBuilder("[");
final Iterator<String> colors = COLORS.iterator();
while (markers.hasNext()) {
final String marker = markers.next();
final String color;
if (colors.hasNext()) {
color = colors.next();
} else {
color = generateColor();
COLORS.add(color);
}
final SortedMap<Long, Double> gaugeValues = gaugeStore.getGaugeValues(new GaugeValuesRequest(start, end, role), marker);
builder.append(
toJson(
label + " (" + marker + ")",
color,
aggregate(gaugeValues)