Fixed bug with REST API data representation for telemetry plugin
This commit is contained in:
parent
ea32b2d29e
commit
ac5b0f18dd
@ -291,7 +291,6 @@ public class SubscriptionManager {
|
|||||||
} else {
|
} else {
|
||||||
log.trace("[{}] Remote subscription is now handled on new server address: [{}]", s.getWsSessionId(), newAddress);
|
log.trace("[{}] Remote subscription is now handled on new server address: [{}]", s.getWsSessionId(), newAddress);
|
||||||
subscriptionIterator.remove();
|
subscriptionIterator.remove();
|
||||||
|
|
||||||
//TODO: onUpdate state of subscription by WsSessionId and other maps.
|
//TODO: onUpdate state of subscription by WsSessionId and other maps.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,7 +139,12 @@ public class TelemetryRestMsgHandler extends DefaultRestMsgHandler {
|
|||||||
public void onSuccess(PluginContext ctx, List<TsKvEntry> data) {
|
public void onSuccess(PluginContext ctx, List<TsKvEntry> data) {
|
||||||
Map<String, List<TsData>> result = new LinkedHashMap<>();
|
Map<String, List<TsData>> result = new LinkedHashMap<>();
|
||||||
for (TsKvEntry entry : data) {
|
for (TsKvEntry entry : data) {
|
||||||
result.put(entry.getKey(), data.stream().map(v -> new TsData(v.getTs(), v.getValueAsString())).collect(Collectors.toList()));
|
List<TsData> vList = result.get(entry.getKey());
|
||||||
|
if (vList == null) {
|
||||||
|
vList = new ArrayList<>();
|
||||||
|
result.put(entry.getKey(), vList);
|
||||||
|
}
|
||||||
|
vList.add(new TsData(entry.getTs(), entry.getValueAsString()));
|
||||||
}
|
}
|
||||||
msg.getResponseHolder().setResult(new ResponseEntity<>(result, HttpStatus.OK));
|
msg.getResponseHolder().setResult(new ResponseEntity<>(result, HttpStatus.OK));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user