Search in sources :

Example 1 with Value

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

the class SnapshotConverter method convert.

static MetricDimensions convert(Point p) {
    if (p == null) {
        return StateMetricContext.newInstance(null);
    }
    List<String> dimensions = p.dimensions();
    List<Value> location = p.location();
    Map<String, Object> pointWrapper = new HashMap<>(dimensions.size());
    for (int i = 0; i < dimensions.size(); ++i) {
        pointWrapper.put(dimensions.get(i), valueAsString(location.get(i)));
    }
    return StateMetricContext.newInstance(pointWrapper);
}
Also used : Value(com.yahoo.metrics.simple.Value) Point(com.yahoo.metrics.simple.Point)

Example 2 with Value

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

the class SnapshotConverter method getIdentifierString.

private String getIdentifierString(Identifier id) {
    StringBuilder buffer = new StringBuilder();
    Point location = id.getLocation();
    buffer.append(id.getName());
    if (location != null) {
        buffer.append(", dimensions: { ");
        Iterator<String> dimensions = location.dimensions().iterator();
        Iterator<Value> values = location.location().iterator();
        boolean firstDimension = true;
        while (dimensions.hasNext() && values.hasNext()) {
            if (firstDimension) {
                firstDimension = false;
            } else {
                buffer.append(", ");
            }
            serializeSingleDimension(buffer, dimensions.next(), values.next());
        }
        buffer.append(" }");
    }
    return buffer.toString();
}
Also used : Value(com.yahoo.metrics.simple.Value) Point(com.yahoo.metrics.simple.Point)

Aggregations

Point (com.yahoo.metrics.simple.Point)2 Value (com.yahoo.metrics.simple.Value)2