blob: aba2f9cd6897782e8456e2db2ba599fb96577490 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.handler.observability;
import com.fasterxml.jackson.databind.JsonNode;
import com.yahoo.container.Container;
import com.yahoo.container.handler.observability.ApplicationStatusHandler;
import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.search.handler.SearchHandler;
import com.yahoo.search.searchchain.SearchChainRegistry;
import java.util.Map;
/**
* @author bjorncs
*/
public class SearchStatusExtension implements ApplicationStatusHandler.Extension {
@Override
public Map<String, ? extends JsonNode> produceExtraFields(ApplicationStatusHandler handler) {
return Map.of("searchChains", renderSearchChains(Container.get()));
}
private static JsonNode renderSearchChains(Container container) {
for (RequestHandler h : container.getRequestHandlerRegistry().allComponents()) {
if (h instanceof SearchHandler) {
SearchChainRegistry scReg = ((SearchHandler) h).getSearchChainRegistry();
return ApplicationStatusHandler.StatusResponse.renderChains(scReg);
}
}
return ApplicationStatusHandler.jsonMapper.createObjectNode();
}
}
|