Search in sources :

Example 1 with Identifier

use of com.yahoo.metrics.simple.Identifier in project vespa by vespa-engine.

the class SnapshotConverter method convert.

MetricSnapshot convert() {
    for (Map.Entry<Identifier, UntypedMetric> entry : snapshot.entrySet()) {
        Identifier ident = entry.getKey();
        getMap(ident.getLocation()).put(ident.getName(), convert(entry.getValue()));
    }
    Map<MetricDimensions, MetricSet> data = new HashMap<>();
    for (Map.Entry<Point, Map<String, MetricValue>> entry : perPointData.entrySet()) {
        MetricDimensions key = convert(entry.getKey());
        MetricSet newval = new MetricSet(entry.getValue());
        MetricSet old = data.get(key);
        if (old != null) {
            // should not happen, this is bad
            // TODO: consider merging the two MetricSet instances
            log.warning("losing MetricSet when converting for: " + entry.getKey());
        } else {
            data.put(key, newval);
        }
    }
    return new MetricSnapshot(snapshot.getFromMillis(), snapshot.getToMillis(), TimeUnit.MILLISECONDS, data);
}
Also used : Identifier(com.yahoo.metrics.simple.Identifier) Point(com.yahoo.metrics.simple.Point) UntypedMetric(com.yahoo.metrics.simple.UntypedMetric)

Example 2 with Identifier

use of com.yahoo.metrics.simple.Identifier in project vespa by vespa-engine.

the class SnapshotConverter method outputHistograms.

void outputHistograms(PrintStream output) {
    boolean gotHistogram = false;
    for (Map.Entry<Identifier, UntypedMetric> entry : snapshot.entrySet()) {
        if (entry.getValue().getHistogram() == null) {
            continue;
        }
        gotHistogram = true;
        DoubleHistogram histogram = entry.getValue().getHistogram();
        Identifier id = entry.getKey();
        String metricIdentifier = getIdentifierString(id);
        output.println("# start of metric " + metricIdentifier);
        histogram.outputPercentileDistribution(output, 4, 1.0d, true);
        output.println("# end of metric " + metricIdentifier);
    }
    if (!gotHistogram) {
        output.println("# No histograms currently available.");
    }
}
Also used : DoubleHistogram(org.HdrHistogram.DoubleHistogram) Identifier(com.yahoo.metrics.simple.Identifier) UntypedMetric(com.yahoo.metrics.simple.UntypedMetric)

Aggregations

Identifier (com.yahoo.metrics.simple.Identifier)2 UntypedMetric (com.yahoo.metrics.simple.UntypedMetric)2 Point (com.yahoo.metrics.simple.Point)1 DoubleHistogram (org.HdrHistogram.DoubleHistogram)1