Search in sources :

Example 1 with ClusterSearcher

use of com.yahoo.prelude.cluster.ClusterSearcher in project vespa by vespa-engine.

the class BackendStatistics method invoke.

public void invoke(Request request) {
    try {
        Collection<ClusterSearcher> searchers = clusterSearchers(request);
        List<String> backendIdentificators = new ArrayList<>();
        List<Integer> activeConnections = new ArrayList<>();
        List<Integer> totalConnections = new ArrayList<>();
        for (ClusterSearcher searcher : searchers) {
            for (Map.Entry<String, Backend.BackendStatistics> statistics : searcher.getBackendStatistics().entrySet()) {
                backendIdentificators.add(statistics.getKey());
                activeConnections.add(statistics.getValue().activeConnections);
                totalConnections.add(statistics.getValue().totalConnections());
            }
        }
        Values returnValues = request.returnValues();
        returnValues.add(new StringArray(backendIdentificators.toArray(new String[0])));
        addInt32Array(returnValues, activeConnections);
        addInt32Array(returnValues, totalConnections);
    } catch (Exception e) {
        request.setError(1000, Exceptions.toMessageString(e));
    }
}
Also used : ArrayList(java.util.ArrayList) Values(com.yahoo.jrt.Values) StringArray(com.yahoo.jrt.StringArray) ClusterSearcher(com.yahoo.prelude.cluster.ClusterSearcher) Map(java.util.Map)

Example 2 with ClusterSearcher

use of com.yahoo.prelude.cluster.ClusterSearcher in project vespa by vespa-engine.

the class TracePackets method invoke.

public void invoke(Request request) {
    try {
        Collection<ClusterSearcher> searchers = clusterSearchers(request);
        boolean on = request.parameters().get(1).asInt8() != 0;
        for (ClusterSearcher searcher : searchers) searcher.dumpPackets(packetType, on);
    } catch (Exception e) {
        request.setError(1000, Exceptions.toMessageString(e));
    }
}
Also used : ClusterSearcher(com.yahoo.prelude.cluster.ClusterSearcher)

Aggregations

ClusterSearcher (com.yahoo.prelude.cluster.ClusterSearcher)2 StringArray (com.yahoo.jrt.StringArray)1 Values (com.yahoo.jrt.Values)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1