Search in sources :

Example 6 with FlowRttStatsData

use of org.openkilda.messaging.info.stats.FlowRttStatsData 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 7 with FlowRttStatsData

use of org.openkilda.messaging.info.stats.FlowRttStatsData in project open-kilda by telstra.

the class FlowRttMetricGenBolt method handleInput.

@Override
protected void handleInput(Tuple input) throws Exception {
    if (active) {
        InfoMessage message = (InfoMessage) input.getValueByField(KafkaRecordTranslator.FIELD_ID_PAYLOAD);
        FlowRttStatsData data = (FlowRttStatsData) message.getData();
        Map<String, String> tags = ImmutableMap.of("direction", data.getDirection(), "flowid", data.getFlowId(), "origin", "server42");
        long t0 = noviflowTimestamp(data.getT0());
        long t1 = noviflowTimestamp(data.getT1());
        // We decided to use t1 time as a timestamp for Datapoint.
        long timestamp = TimeUnit.NANOSECONDS.toMillis(t1);
        emitMetric("flow.rtt", timestamp, t1 - t0, tags);
    }
}
Also used : FlowRttStatsData(org.openkilda.messaging.info.stats.FlowRttStatsData) InfoMessage(org.openkilda.messaging.info.InfoMessage)

Aggregations

FlowRttStatsData (org.openkilda.messaging.info.stats.FlowRttStatsData)7 InfoMessage (org.openkilda.messaging.info.InfoMessage)5 Test (org.junit.Test)3 Values (org.apache.storm.tuple.Values)2 UpdateFlowCommand (org.openkilda.messaging.info.flow.UpdateFlowCommand)2 FlowLatencyPacket (org.openkilda.server42.stats.messaging.Statistics.FlowLatencyPacket)2 Link (org.openkilda.wfm.topology.flowmonitoring.model.Link)2 Duration (java.time.Duration)1 Instant (java.time.Instant)1 Message (org.openkilda.messaging.Message)1 CommandData (org.openkilda.messaging.command.CommandData)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 Datapoint (org.openkilda.messaging.info.Datapoint)1 InfoData (org.openkilda.messaging.info.InfoData)1 RemoveFlowCommand (org.openkilda.messaging.info.flow.RemoveFlowCommand)1 IslRttStatsData (org.openkilda.messaging.info.stats.IslRttStatsData)1 Flow (org.openkilda.model.Flow)1 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)1 IslLatencyPacket (org.openkilda.server42.stats.messaging.Statistics.IslLatencyPacket)1 Builder (org.openkilda.server42.stats.messaging.Statistics.LatencyPacketBucket.Builder)1