Search in sources :

Example 1 with LatencyPacketBucket

use of org.openkilda.server42.stats.messaging.Statistics.LatencyPacketBucket in project open-kilda by telstra.

the class StatsCollector method sendStats.

void sendStats(LatencyPacketBucket latencyPacketBucket) throws InvalidProtocolBufferException {
    long currentTimeMillis = System.currentTimeMillis();
    for (FlowLatencyPacket packet : latencyPacketBucket.getFlowLatencyPacketList()) {
        FlowRttStatsData data = new FlowRttStatsData(packet.getFlowId(), FlowDirection.fromBoolean(packet.getDirection()).name().toLowerCase(), packet.getT0(), packet.getT1());
        InfoMessage message = new InfoMessage(data, currentTimeMillis, format("stats42-%s-%d", sessionId, packet.getPacketId()));
        log.debug("InfoMessage {}", message);
        template.send(flowStatToStormTopic, packet.getFlowId(), message);
    }
    for (IslLatencyPacket packet : latencyPacketBucket.getIslLatencyPacketList()) {
        IslRttStatsData data = new IslRttStatsData(packet.getSwitchId(), packet.getPort(), packet.getT0(), packet.getT1(), "server42");
        String key = format("%s-%d", packet.getSwitchId(), packet.getPort());
        InfoMessage message = new InfoMessage(data, currentTimeMillis, format("stats42-%s-isl-%s", sessionId, key));
        log.debug("InfoMessage {}", message);
        template.send(islStatToStormTopic, key, message);
    }
}
Also used : FlowRttStatsData(org.openkilda.messaging.info.stats.FlowRttStatsData) IslLatencyPacket(org.openkilda.server42.stats.messaging.Statistics.IslLatencyPacket) InfoMessage(org.openkilda.messaging.info.InfoMessage) FlowLatencyPacket(org.openkilda.server42.stats.messaging.Statistics.FlowLatencyPacket) IslRttStatsData(org.openkilda.messaging.info.stats.IslRttStatsData)

Example 2 with LatencyPacketBucket

use of org.openkilda.server42.stats.messaging.Statistics.LatencyPacketBucket in project open-kilda by telstra.

the class StatsCollector method handleInput.

private void handleInput(byte[] recv) {
    try {
        LatencyPacketBucket latencyPacketBucket = LatencyPacketBucket.parseFrom(recv);
        log.debug("getFlowLatencyPacketList size: {}, getIslLatencyPacketList size: {}", latencyPacketBucket.getFlowLatencyPacketList().size(), latencyPacketBucket.getIslLatencyPacketList().size());
        sendStats(latencyPacketBucket);
    } catch (InvalidProtocolBufferException e) {
        log.error(e.toString());
    }
}
Also used : LatencyPacketBucket(org.openkilda.server42.stats.messaging.Statistics.LatencyPacketBucket) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException)

Aggregations

InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 FlowRttStatsData (org.openkilda.messaging.info.stats.FlowRttStatsData)1 IslRttStatsData (org.openkilda.messaging.info.stats.IslRttStatsData)1 FlowLatencyPacket (org.openkilda.server42.stats.messaging.Statistics.FlowLatencyPacket)1 IslLatencyPacket (org.openkilda.server42.stats.messaging.Statistics.IslLatencyPacket)1 LatencyPacketBucket (org.openkilda.server42.stats.messaging.Statistics.LatencyPacketBucket)1