added one more filtering for metrics data
This commit is contained in:
parent
137b1732bb
commit
55b6b8c564
@ -398,14 +398,19 @@ public abstract class AbstractGatewaySessionHandler<T extends AbstractGatewayDev
|
|||||||
var serverReceiveTs = System.currentTimeMillis();
|
var serverReceiveTs = System.currentTimeMillis();
|
||||||
var metricsData = metadata.stream()
|
var metricsData = metadata.stream()
|
||||||
.filter(JsonElement::isJsonObject)
|
.filter(JsonElement::isJsonObject)
|
||||||
.map(je -> {
|
.map(JsonElement::getAsJsonObject)
|
||||||
var jo = je.getAsJsonObject();
|
.filter(jo -> jo.has("connector")
|
||||||
|
&& jo.has("receivedTs")
|
||||||
|
&& jo.has("publishedTs"))
|
||||||
|
.map(jo -> {
|
||||||
var connector = jo.get("connector").getAsString();
|
var connector = jo.get("connector").getAsString();
|
||||||
var receivedTs = jo.get("receivedTs").getAsLong();
|
var receivedTs = jo.get("receivedTs").getAsLong();
|
||||||
var publishedTs = jo.get("publishedTs").getAsLong();
|
var publishedTs = jo.get("publishedTs").getAsLong();
|
||||||
return new GatewayMetricsData(connector, receivedTs, publishedTs);
|
return new GatewayMetricsData(connector, receivedTs, publishedTs);
|
||||||
}).toList();
|
}).toList();
|
||||||
gatewayMetricsService.process(deviceSessionCtx.getSessionInfo(), gateway.getDeviceId(), metricsData, serverReceiveTs);
|
if (!metadata.isEmpty()) {
|
||||||
|
gatewayMetricsService.process(deviceSessionCtx.getSessionInfo(), gateway.getDeviceId(), metricsData, serverReceiveTs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onDeviceTelemetryProto(int msgId, ByteBuf payload) throws AdaptorException {
|
protected void onDeviceTelemetryProto(int msgId, ByteBuf payload) throws AdaptorException {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user