mercredi 18 avril 2018

Comparing Events with each other

So I have events coming in in this format

TransactionID, MicroserviceName, Direction,EpochTimeStamp.

For each call to a microservice and event is generates with a timestamp with direction of "in". Then when completed it generates with a timestamp with direction of "out".

I need to calculate latency for both the microservices per transactions and for the entire transaction.

Example Data (TransactionID, MicroserviceName, Direction,EpochTimeStamp)

1,A,in,1700 1,B,in,1702 1,B,out,1704 1,C,in,1704 1,D,in,1705 1,D,out,1706 1,C,out,1709 1,A,out,1710

Look for a pattern to handle this.

Something like this

        Pattern<MetricsEvent,?> pattern = Pattern.<MetricsEvent>begin("myBegin").where(
            new SimpleCondition<MetricsEvent>() {
                public boolean filter(MetricsEvent metricsEvent) throws Exception {
                    return metricsEvent.getDirection().equals("in");
                }
            }
    ).followedBy("myNext").where(
            new SimpleCondition<MetricsEvent>() {
                public boolean filter(MetricsEvent metricsEvent) throws Exception {
                    metricsEvent.getApplication().equals(//PREVIOUS EVENT.getApplication()))
                    return false;
                }
            }
    )

I'm note sure how to get the previous event to compare too.

Then how to calculate the latency between the two events?

Aucun commentaire:

Enregistrer un commentaire