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 relabel path of ehttp client to solve the high cardinality issue #322

Merged
merged 1 commit into from
Apr 2, 2023

Conversation

clannadxr
Copy link
Contributor

HTTP 客户端的请求的 path 里如果有参数会在指标系统里产生高基数问题

一般场景下,通过在 url 里加上参数占位符,并设置 path 参数可以解决这一问题,如:

comp.R().SetPathParam("foo", "bar").Get("/id/{foo}")

这样拦截器里获取的 url path 会是 /id{foo}

但有些场景,如:使用 ehttp 客户端转发请求时,我们并不方便使用上述方式一个一个指定请求 url,这时候可能需要支持配置 path 的重写规则,匹配带参数 path 重命名为统一的 path

注意使用该配置会带来一定的性能开销

@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Merging #322 (6511233) into master (ca292bd) will decrease coverage by 0.04%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #322      +/-   ##
==========================================
- Coverage   58.72%   58.68%   -0.04%     
==========================================
  Files          80       80              
  Lines        2958     2958              
==========================================
- Hits         1737     1736       -1     
  Misses       1055     1055              
- Partials      166      167       +1     
Flag Coverage Δ
unittests 58.68% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@askuy askuy merged commit 14ecaed into gotomicro:master Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants