-
Notifications
You must be signed in to change notification settings - Fork 725
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
api,config: enable audit-middleware in default config #5592
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com> default enable audit Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com> default enable audit Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
6835ab8
to
4c9a833
Compare
Codecov ReportBase: 75.74% // Head: 75.67% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5592 +/- ##
==========================================
- Coverage 75.74% 75.67% -0.07%
==========================================
Files 326 326
Lines 32251 32251
==========================================
- Hits 24427 24405 -22
- Misses 5722 5735 +13
- Partials 2102 2111 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
/run-monitor-test |
Visit the grafana server at: http://172.16.5.21:30640, it will last for 5 hours |
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com> add grafana Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
e583692
to
fa31d41
Compare
/run-monitor-test |
Visit the grafana server at: http://172.16.5.21:32173, it will last for 5 hours |
metrics/grafana/pd.json
Outdated
"timeFrom": null, | ||
"timeRegions": [], | ||
"timeShift": null, | ||
"title": "Completed commands rate", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding HTTP prefix?
server/api/router.go
Outdated
|
||
rulesHandler := newRulesHandler(svr, rd) | ||
registerFunc(clusterRouter, "/config/rules", rulesHandler.GetAllRules, setMethods(http.MethodGet)) | ||
registerFunc(clusterRouter, "/config/rules", rulesHandler.SetAllRules, setMethods(http.MethodPost), setAuditBackend(localLog)) | ||
registerFunc(clusterRouter, "/config/rules/batch", rulesHandler.BatchRules, setMethods(http.MethodPost), setAuditBackend(localLog)) | ||
registerFunc(clusterRouter, "/config/rules", rulesHandler.SetAllRules, setMethods(http.MethodPost), setAuditBackend(localLog), setAuditBackend(prometheus)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add metrics for all API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registerFunc(clusterRouter, "/config/rules", rulesHandler.SetAllRules, setMethods(http.MethodPost), setAuditBackend(localLog), setAuditBackend(prometheus)) | |
registerFunc(clusterRouter, "/config/rules", rulesHandler.SetAllRules, setMethods(http.MethodPost), setAuditBackend(localLog, prometheus)) |
server/api/router.go
Outdated
registerFunc(apiRouter, "/members/id/{id}", memberHandler.DeleteMemberByID, setMethods(http.MethodDelete), setAuditBackend(localLog)) | ||
registerFunc(apiRouter, "/members/name/{name}", memberHandler.SetMemberPropertyByName, setMethods(http.MethodPost), setAuditBackend(localLog)) | ||
registerFunc(apiRouter, "/members", memberHandler.GetMembers, setMethods(http.MethodGet), setAuditBackend(prometheus)) | ||
registerFunc(apiRouter, "/members/name/{name}", memberHandler.DeleteMemberByName, setMethods(http.MethodDelete), setAuditBackend(localLog), setAuditBackend(prometheus)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
BTW, I suggest adding a comment to explain the principle of using logs or metrics. |
server/api/router.go
Outdated
registerFunc(apiRouter, "/config/replication-mode", confHandler.GetReplicationModeConfig, setMethods(http.MethodGet)) | ||
registerFunc(apiRouter, "/config/replication-mode", confHandler.SetReplicationModeConfig, setMethods(http.MethodPost)) | ||
registerFunc(apiRouter, "/config/replication-mode", confHandler.SetReplicationModeConfig, setMethods(http.MethodPost), setAuditBackend(localLog)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think also need for Prometheus for this api
metrics/grafana/pd.json
Outdated
@@ -8176,7 +8176,7 @@ | |||
"timeFrom": null, | |||
"timeRegions": [], | |||
"timeShift": null, | |||
"title": "Completed commands rate", | |||
"title": " gRPC Completed commands rate", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"title": " gRPC Completed commands rate", | |
"title": "gRPC Completed commands rate", |
fe42952
to
e938484
Compare
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com> all api supporting metrics Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com> all api supporting metrics Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
e938484
to
fe89dba
Compare
/merge |
@rleungx: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: fe89dba
|
@CabinfeverB: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Signed-off-by: Cabinfever_B cabinfeveroier@gmail.com
default enable audit
Signed-off-by: Cabinfever_B cabinfeveroier@gmail.com
What problem does this PR solve?
Issue Number: ref #4480
What is changed and how does it work?
Check List
Tests
Unit test
Integration test
Manual test (add detailed scripts or steps below)
Benchmark test result
BenchmarkDoRequestWithLocalLogAudit
BenchmarkDoRequestWithPrometheusAudit
BenchmarkDoRequestWithoutServiceMiddleware
Code changes
Release note