Search in sources :

Example 51 with Request

use of org.apache.zookeeper.server.Request in project incubator-pulsar by apache.

the class FinalRequestProcessorAspect method timedProcessRequest.

@Around("processRequest()")
public void timedProcessRequest(ProceedingJoinPoint joinPoint) throws Throwable {
    joinPoint.proceed();
    Request request = (Request) joinPoint.getArgs()[0];
    String type = requestTypeMap.getOrDefault(request.type, "unknown");
    requests.labels(type).inc();
    long latencyMs = System.currentTimeMillis() - request.createTime;
    String latencyLabel = isWriteRequest(request.type) ? "write" : "read";
    requestsLatency.labels(latencyLabel).observe(latencyMs);
}
Also used : Request(org.apache.zookeeper.server.Request) Around(org.aspectj.lang.annotation.Around)

Aggregations

Request (org.apache.zookeeper.server.Request)51 Test (org.junit.jupiter.api.Test)25 CreateRequest (org.apache.zookeeper.proto.CreateRequest)15 IOException (java.io.IOException)9 ByteBuffer (java.nio.ByteBuffer)9 GetDataRequest (org.apache.zookeeper.proto.GetDataRequest)9 SetDataRequest (org.apache.zookeeper.proto.SetDataRequest)9 TxnHeader (org.apache.zookeeper.txn.TxnHeader)9 HashSet (java.util.HashSet)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 BinaryOutputArchive (org.apache.jute.BinaryOutputArchive)6 Record (org.apache.jute.Record)6 KeeperException (org.apache.zookeeper.KeeperException)5 SetDataTxn (org.apache.zookeeper.txn.SetDataTxn)5 Id (org.apache.zookeeper.data.Id)4 ErrorTxn (org.apache.zookeeper.txn.ErrorTxn)4 OutputArchive (org.apache.jute.OutputArchive)3 ZooKeeper (org.apache.zookeeper.ZooKeeper)3 TxnLogEntry (org.apache.zookeeper.server.TxnLogEntry)3 QuorumVerifier (org.apache.zookeeper.server.quorum.flexible.QuorumVerifier)3