Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
keranbingaa authored Dec 3, 2022
1 parent 20181bb commit 01bb682
Showing 1 changed file with 22 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public HttpSummaryMetrics(final ThreadPoolExecutor batchMsgExecutor,
}

public static final String EVENTMESH_MONITOR_FORMAT_HTTP = "{\"maxHTTPTPS\":\"%.1f\",\"avgHTTPTPS\":\"%.1f\","
//EVENTMESH tps related to accepting external http requests
+ "\"maxHTTPCOST\":\"%s\",\"avgHTTPCOST\":\"%.1f\",\"avgHTTPBodyDecodeCost\":\"%.1f\", "
+ "\"httpDiscard\":\"%s\"}";
//EVENTMESH tps related to accepting external http requests
+ "\"maxHTTPCOST\":\"%s\",\"avgHTTPCOST\":\"%.1f\",\"avgHTTPBodyDecodeCost\":\"%.1f\", "
+ "\"httpDiscard\":\"%s\"}";

private float wholeCost = 0f;

Expand All @@ -60,13 +60,11 @@ public HttpSummaryMetrics(final ThreadPoolExecutor batchMsgExecutor,
private LinkedList<Integer> httpRequestTPSSnapshots = new LinkedList<>();

public float avgHTTPCost() {
float cost = (wholeRequestNum.longValue() == 0L) ? 0f : wholeCost / wholeRequestNum.longValue();
return cost;
return (wholeRequestNum.longValue() == 0L) ? 0f : wholeCost / wholeRequestNum.longValue();
}

public long maxHTTPCost() {
long cost = maxCost.longValue();
return cost;
return maxCost.longValue();
}

public long getHttpDiscard() {
Expand All @@ -91,13 +89,11 @@ public void snapshotHTTPTPS() {
}

public float maxHTTPTPS() {
float tps = Collections.max(httpRequestTPSSnapshots);
return tps;
return Collections.max(httpRequestTPSSnapshots);
}

public float avgHTTPTPS() {
float tps = avg(httpRequestTPSSnapshots);
return tps;
return avg(httpRequestTPSSnapshots);
}

public void recordHTTPReqResTimeCost(long cost) {
Expand Down Expand Up @@ -126,14 +122,13 @@ public void recordDecodeTimeCost(long cost) {
}

public float avgHTTPBodyDecodeCost() {
float cost = (httpDecodeNum.longValue() == 0L) ? 0f : httpDecodeTimeCost / httpDecodeNum.longValue();
return cost;
return (httpDecodeNum.longValue() == 0L) ? 0f : httpDecodeTimeCost / httpDecodeNum.longValue();
}


//////////////////////////////////////////////////////////////////////////
public static final String EVENTMESH_MONITOR_FORMAT_BATCHSENDMSG = "{\"maxBatchSendMsgTPS\":\"%.1f\",\"avgBatchSendMsgTPS\":\"%.1f\","
+ " \"sum\":\"%s\", \"sumFail\":\"%s\", \"sumFailRate\":\"%.2f\", \"discard\":\"%s\"}";
+ " \"sum\":\"%s\", \"sumFail\":\"%s\", \"sumFailRate\":\"%.2f\", \"discard\":\"%s\"}";

private AtomicLong sendBatchMsgNumPerSecond = new AtomicLong(0);

Expand All @@ -160,13 +155,11 @@ public void snapshotSendBatchMsgTPS() {
}

public float maxSendBatchMsgTPS() {
float tps = Collections.max(sendBatchMsgTPSSnapshots);
return tps;
return Collections.max(sendBatchMsgTPSSnapshots);
}

public float avgSendBatchMsgTPS() {
float tps = avg(sendBatchMsgTPSSnapshots);
return tps;
return avg(sendBatchMsgTPSSnapshots);
}

public void recordSendBatchMsg(long delta) {
Expand Down Expand Up @@ -201,7 +194,7 @@ public long getSendBatchMsgDiscardNumSum() {

//////////////////////////////////////////////////////////////////////////
public static final String EVENTMESH_MONITOR_FORMAT_SENDMSG = "{\"maxSendMsgTPS\":\"%.1f\",\"avgSendMsgTPS\":\"%.1f\","
+ " \"sum\":\"%s\", \"sumFail\":\"%s\", \"sumFailRate\":\"%.2f\", \"replyMsg\":\"%s\", \"replyFail\":\"%s\"}";
+ " \"sum\":\"%s\", \"sumFail\":\"%s\", \"sumFailRate\":\"%.2f\", \"replyMsg\":\"%s\", \"replyFail\":\"%s\"}";

private AtomicLong sendMsgNumSum = new AtomicLong(0);

Expand All @@ -225,13 +218,11 @@ public void snapshotSendMsgTPS() {
}

public float maxSendMsgTPS() {
float tps = Collections.max(sendMsgTPSSnapshots);
return tps;
return Collections.max(sendMsgTPSSnapshots);
}

public float avgSendMsgTPS() {
float tps = avg(sendMsgTPSSnapshots);
return tps;
return avg(sendMsgTPSSnapshots);
}

public void recordSendMsg() {
Expand Down Expand Up @@ -280,7 +271,7 @@ public void cleanSendMsgStat() {

////////////////////////////////////////////////////////////////////////////
public static final String EVENTMESH_MONITOR_FORMAT_PUSHMSG = "{\"maxPushMsgTPS\":\"%.1f\",\"avgPushMsgTPS\":\"%.1f\","
+ " \"sum\":\"%s\", \"sumFail\":\"%s\", \"sumFailRate\":\"%.1f\", \"maxClientLatency\":\"%.1f\", \"avgClientLatency\":\"%.1f\"}";
+ " \"sum\":\"%s\", \"sumFail\":\"%s\", \"sumFailRate\":\"%.1f\", \"maxClientLatency\":\"%.1f\", \"avgClientLatency\":\"%.1f\"}";

private float wholePushCost = 0f;

Expand Down Expand Up @@ -322,13 +313,11 @@ public float maxHTTPPushLatency() {
}

public float maxPushMsgTPS() {
float tps = Collections.max(pushMsgTPSSnapshots);
return tps;
return Collections.max(pushMsgTPSSnapshots);
}

public float avgPushMsgTPS() {
float tps = avg(pushMsgTPSSnapshots);
return tps;
return avg(pushMsgTPSSnapshots);
}

public void recordPushMsg() {
Expand Down Expand Up @@ -362,11 +351,11 @@ public void cleanHttpPushMsgStat() {

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static final String EVENTMESH_MONITOR_FORMAT_BLOCKQ = "{\"batchMsgQ\":\"%s\",\"sendMsgQ\":\"%s\","
+ "\"pushMsgQ\":\"%s\",\"httpRetryQ\":\"%s\"}";
+ "\"pushMsgQ\":\"%s\",\"httpRetryQ\":\"%s\"}";

///////////////////////////////////////////////////////////////////////////
public static final String EVENTMESH_MONITOR_FORMAT_MQ_CLIENT = "{\"batchAvgSend2MQCost\":\"%.1f\", "
+ "\"avgSend2MQCost\":\"%.1f\", \"avgReply2MQCost\":\"%.1f\"}";
+ "\"avgSend2MQCost\":\"%.1f\", \"avgReply2MQCost\":\"%.1f\"}";

private float batchSend2MQWholeCost = 0f;

Expand All @@ -386,8 +375,7 @@ public void recordBatchSendMsgCost(long cost) {
}

public float avgBatchSendMsgCost() {
float cost = (batchSend2MQNum.intValue() == 0) ? 0f : batchSend2MQWholeCost / batchSend2MQNum.intValue();
return cost;
return (batchSend2MQNum.intValue() == 0) ? 0f : batchSend2MQWholeCost / batchSend2MQNum.intValue();
}

public void recordSendMsgCost(long cost) {
Expand All @@ -396,8 +384,7 @@ public void recordSendMsgCost(long cost) {
}

public float avgSendMsgCost() {
float cost = (send2MQNum.intValue() == 0) ? 0f : send2MQWholeCost / send2MQNum.intValue();
return cost;
return (send2MQNum.intValue() == 0) ? 0f : send2MQWholeCost / send2MQNum.intValue();
}

public void recordReplyMsgCost(long cost) {
Expand All @@ -406,8 +393,7 @@ public void recordReplyMsgCost(long cost) {
}

public float avgReplyMsgCost() {
float cost = (reply2MQNum.intValue() == 0) ? 0f : reply2MQWholeCost / reply2MQNum.intValue();
return cost;
return (reply2MQNum.intValue() == 0) ? 0f : reply2MQWholeCost / reply2MQNum.intValue();
}

public void send2MQStatInfoClear() {
Expand Down

0 comments on commit 01bb682

Please sign in to comment.