ccaominh commented on a change in pull request #8547: Add `sys.supervisors`
table to system tables
URL: https://github.com/apache/incubator-druid/pull/8547#discussion_r325770577
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java
##########
@@ -132,24 +137,39 @@ public Response specGetAll(
);
final boolean includeFull = full != null;
final boolean includeState = state != null && state;
+ final boolean includeFullStatus = fullStatus != null;
- if (includeFull || includeState) {
- List<Map<String, ?>> allStates = authorizedSupervisorIds
+ if (includeFull || includeState || includeFullStatus) {
+ List<SupervisorStatus> allStates = authorizedSupervisorIds
.stream()
.map(x -> {
Optional<SupervisorStateManager.State> theState =
manager.getSupervisorState(x);
- ImmutableMap.Builder<String, Object> theBuilder =
ImmutableMap.builder();
- theBuilder.put("id", x);
+ SupervisorStatus.Builder theBuilder = new
SupervisorStatus.Builder();
+ theBuilder.withId(x);
if (theState.isPresent()) {
- theBuilder.put("state", theState.get().getBasicState());
- theBuilder.put("detailedState", theState.get());
- theBuilder.put("healthy", theState.get().isHealthy());
+
theBuilder.withState(theState.get().getBasicState().toString())
+ .withDetailedState(theState.get().toString())
+ .withHealthy(theState.get().isHealthy());
}
if (includeFull) {
Optional<SupervisorSpec> theSpec =
manager.getSupervisorSpec(x);
if (theSpec.isPresent()) {
- theBuilder.put("spec", theSpec.get());
+ theBuilder.withSpec(manager.getSupervisorSpec(x).get());
+ }
+ }
+ if (includeFullStatus) {
+ Optional<SupervisorSpec> theSpec =
manager.getSupervisorSpec(x);
+ if (theSpec.isPresent()) {
+ try {
+
theBuilder.withSpecString(objectMapper.writeValueAsString(manager.getSupervisorSpec(x).get()));
Review comment:
Oh, since the SupervisorStatus DTO already has a SupervisorSpec field that
gets serialized when the response is serialized, why do you need to have
another field that's an explicitly serialized version (which is populated
before the response is serialized)?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]