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

refactor: gin prometheus for api #1371

Merged

Conversation

rfyiamcool
Copy link
Contributor

summary

  1. if don't close http.response.body, throw resource leak. ( goroutine leak and fd leak)
  2. replace io.ReadAll to io.ioutil, io.ioutil is deprecated in go1.16.
  3. use gin.context.FullPATH, because gin.Request.URL.PATH is full url with query params. e.g. prometheus only need to record /article/:uid url, don't need /article/13183?page_index=10&page=100&q=xxx&order=desc. when the url is randomized, this design is not friendly to prome storage and does not display well in grafana.
  4. refactor the code.

image

Copy link
Contributor

sweep-ai bot commented Nov 9, 2023

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #1371 (3c9fd05) into main (2496a16) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##            main   #1371   +/-   ##
=====================================
  Coverage   4.30%   4.30%           
=====================================
  Files         45      45           
  Lines       3809    3809           
=====================================
  Hits         164     164           
  Misses      3634    3634           
  Partials      11      11           

cubxxw
cubxxw previously approved these changes Nov 10, 2023
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
@openimbot openimbot added this pull request to the merge queue Nov 13, 2023
Merged via the queue into openimsdk:main with commit 65c1c41 Nov 13, 2023
20 of 21 checks passed
@openimsdk openimsdk locked and limited conversation to collaborators Nov 13, 2023
@github-actions github-actions bot added this to the v3.1 milestone Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants