Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support metric for grpc server request #11427

Merged
merged 5 commits into from
Dec 29, 2023

Conversation

Daydreamer-ia
Copy link
Contributor

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

#10846
XXXXX

# HELP grpc_server_requests_seconds_max  
# TYPE grpc_server_requests_seconds_max gauge
grpc_server_requests_seconds_max{errorCode="0",module="config",requestClass="ConfigPublishRequest",success="true",throwableClass="None",} 0.136027
grpc_server_requests_seconds_max{errorCode="0",module="config",requestClass="ConfigRemoveRequest",success="true",throwableClass="None",} 0.0671147
grpc_server_requests_seconds_max{errorCode="0",module="naming",requestClass="SubscribeServiceRequest",success="true",throwableClass="None",} 0.0139512
grpc_server_requests_seconds_max{errorCode="0",module="config",requestClass="ConfigQueryRequest",success="true",throwableClass="None",} 0.0061379
grpc_server_requests_seconds_max{errorCode="0",module="naming",requestClass="InstanceRequest",success="true",throwableClass="None",} 0.0185975
grpc_server_requests_seconds_max{errorCode="0",module="internal",requestClass="HealthCheckRequest",success="true",throwableClass="None",} 0.0014617
grpc_server_requests_seconds_max{errorCode="300",module="config",requestClass="ConfigQueryRequest",success="true",throwableClass="None",} 0.0552467
grpc_server_requests_seconds_max{errorCode="0",module="config",requestClass="ConfigBatchListenRequest",success="true",throwableClass="None",} 0.0155547
grpc_server_requests_seconds_max{errorCode="0",module="unknown",requestClass="ServerCheckRequest",success="true",throwableClass="None",} 0.1011771
# HELP grpc_server_requests_seconds  
# TYPE grpc_server_requests_seconds summary
grpc_server_requests_seconds_count{errorCode="0",module="config",requestClass="ConfigPublishRequest",success="true",throwableClass="None",} 1.0
grpc_server_requests_seconds_sum{errorCode="0",module="config",requestClass="ConfigPublishRequest",success="true",throwableClass="None",} 0.136027
grpc_server_requests_seconds_count{errorCode="0",module="config",requestClass="ConfigRemoveRequest",success="true",throwableClass="None",} 1.0
grpc_server_requests_seconds_sum{errorCode="0",module="config",requestClass="ConfigRemoveRequest",success="true",throwableClass="None",} 0.0671147
grpc_server_requests_seconds_count{errorCode="0",module="naming",requestClass="SubscribeServiceRequest",success="true",throwableClass="None",} 1.0
grpc_server_requests_seconds_sum{errorCode="0",module="naming",requestClass="SubscribeServiceRequest",success="true",throwableClass="None",} 0.0139512
grpc_server_requests_seconds_count{errorCode="0",module="config",requestClass="ConfigQueryRequest",success="true",throwableClass="None",} 2.0
grpc_server_requests_seconds_sum{errorCode="0",module="config",requestClass="ConfigQueryRequest",success="true",throwableClass="None",} 0.0096706
grpc_server_requests_seconds_count{errorCode="0",module="naming",requestClass="InstanceRequest",success="true",throwableClass="None",} 2.0
grpc_server_requests_seconds_sum{errorCode="0",module="naming",requestClass="InstanceRequest",success="true",throwableClass="None",} 0.0247077
grpc_server_requests_seconds_count{errorCode="0",module="internal",requestClass="HealthCheckRequest",success="true",throwableClass="None",} 10.0
grpc_server_requests_seconds_sum{errorCode="0",module="internal",requestClass="HealthCheckRequest",success="true",throwableClass="None",} 0.0065304
grpc_server_requests_seconds_count{errorCode="300",module="config",requestClass="ConfigQueryRequest",success="true",throwableClass="None",} 3.0
grpc_server_requests_seconds_sum{errorCode="300",module="config",requestClass="ConfigQueryRequest",success="true",throwableClass="None",} 0.058394
grpc_server_requests_seconds_count{errorCode="0",module="config",requestClass="ConfigBatchListenRequest",success="true",throwableClass="None",} 5.0
grpc_server_requests_seconds_sum{errorCode="0",module="config",requestClass="ConfigBatchListenRequest",success="true",throwableClass="None",} 0.0218914
grpc_server_requests_seconds_count{errorCode="0",module="unknown",requestClass="ServerCheckRequest",success="true",throwableClass="None",} 2.0
grpc_server_requests_seconds_sum{errorCode="0",module="unknown",requestClass="ServerCheckRequest",success="true",throwableClass="None",} 0.1015446

Brief changelog

XX

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

# Conflicts:
#	core/src/main/java/com/alibaba/nacos/core/monitor/MetricsMonitor.java
@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (327ebaf) 61.62% compared to head (72ab497) 63.89%.
Report is 13 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #11427      +/-   ##
=============================================
+ Coverage      61.62%   63.89%   +2.27%     
- Complexity      6841     7081     +240     
=============================================
  Files           1066     1066              
  Lines          31599    31606       +7     
  Branches        3251     3235      -16     
=============================================
+ Hits           19472    20196     +724     
+ Misses         10782    10144     -638     
+ Partials        1345     1266      -79     
Files Coverage Δ
...com/alibaba/nacos/core/monitor/MetricsMonitor.java 99.15% <100.00%> (+0.06%) ⬆️
...ba/nacos/core/remote/grpc/GrpcRequestAcceptor.java 72.58% <78.94%> (+1.15%) ⬆️

... and 81 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 327ebaf...72ab497. Read the comment docs.

# Conflicts:
#	core/src/main/java/com/alibaba/nacos/core/monitor/MetricsMonitor.java
@@ -176,10 +195,14 @@ public void request(Payload grpcRequest, StreamObserver<Payload> responseObserve
responseObserver.onNext(payloadResponse);
responseObserver.onCompleted();
}, 1000L, TimeUnit.MILLISECONDS);
MetricsMonitor.recordGrpcRequestEvent(type, false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

198-199 和 204-205 是否能提取到if elae外面?看起来内容是一致的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

198 - 199是 OVER_THRESHOLD 的情况,请求处理是失败的,而 204 - 205是正常的。两个的参数有一个不一样

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你不说我都没注意到, 这个地方应该可以取到外面,因为这里其实要要穿入response.isSuccess。

现在的实现只考虑了OVER_THRESHOLD的错误吗, 其他的有错误码但是succss是true的情况

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -176,10 +195,14 @@ public void request(Payload grpcRequest, StreamObserver<Payload> responseObserve
responseObserver.onNext(payloadResponse);
responseObserver.onCompleted();
}, 1000L, TimeUnit.MILLISECONDS);
MetricsMonitor.recordGrpcRequestEvent(type, false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你不说我都没注意到, 这个地方应该可以取到外面,因为这里其实要要穿入response.isSuccess。

现在的实现只考虑了OVER_THRESHOLD的错误吗, 其他的有错误码但是succss是true的情况

@KomachiSion KomachiSion added the kind/feature type/feature label Dec 29, 2023
@KomachiSion KomachiSion added this to the 2.3.1 milestone Dec 29, 2023
@KomachiSion KomachiSion merged commit 6b0636d into alibaba:develop Dec 29, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature type/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants