dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.19k forks source link

feat: add logging for RPC HTTP requests: command, user, http-code, time of running #6073

Open knst opened 2 weeks ago

knst commented 2 weeks ago

Issue being fixed or feature implemented

Currently there is no way to gather stats for http rpc in dash core. This PR aim to change it.

What was done?

Implemented some basic stats for each RPC request:

How Has This Been Tested?

See new logs:

[httpworker.0] [httprpc.cpp:100] [~RpcHttpRequest] -- HTTP RPC request handled: user=platform-user command=getbestblockhash is_external=false status=200 elapsed_time_ms=0
[httpworker.2] [httprpc.cpp:100] [~RpcHttpRequest] -- HTTP RPC request handled: user=platform-user command=quorum is_external=false status=500 elapsed_time_ms=0
[httpworker.3] [httprpc.cpp:100] [~RpcHttpRequest] -- HTTP RPC request handled: user=platform-user command= is_external=false status=401 elapsed_time_ms=0
[httpworker.3] [httprpc.cpp:100] [~RpcHttpRequest] -- HTTP RPC request handled: user=platform-user command=getbestblockhash is_external=true status=200 elapsed_time_ms=28
[httpworker.0] [httprpc.cpp:100] [~RpcHttpRequest] -- HTTP RPC request handled: user=operator command=getbestblockhash is_external=false status=200 elapsed_time_ms=0

Breaking Changes

N/A It doesn't change behavior of rpc server and http server.

Checklist:

DashCoreAutoGuix commented 2 weeks ago

Guix Automation has began to build this PR tagged as v21.0.0-devpr6073.6477bfde. A new comment will be made when the image is pushed.

DashCoreAutoGuix commented 2 weeks ago

Guix Automation has completed; a release should be present here: https://github.com/dashpay/dash-dev-branches/releases/tag/v21.0.0-devpr6073.6477bfde. The image should be on dockerhub soon.

github-actions[bot] commented 2 weeks ago

This pull request has conflicts, please rebase.

github-actions[bot] commented 2 weeks ago

This pull request has conflicts, please rebase.

knst commented 2 weeks ago

@knst knst force-pushed the http-stats branch from 6477bfd to 63e8396

rebased due to conflicts

PastaPastaPasta commented 1 week ago

Have you been able to do any benchmarking and see if this slows down any rpc processing? I wouldn't really expect it to, but maybe it does?