Skip to content

Comments

refactor httpcode metrics logic#7

Merged
LeoQuote merged 2 commits intodouban:mainfrom
DDDFiish:ucloud-exporter-patch
Apr 15, 2025
Merged

refactor httpcode metrics logic#7
LeoQuote merged 2 commits intodouban:mainfrom
DDDFiish:ucloud-exporter-patch

Conversation

@DDDFiish
Copy link
Contributor

原来的exporter存在两个问题:

  1. 指标选取时间过长,可通过调整args解决。
    官方dashboard实际上也是请求的sdk里面的api地址,通过浏览器计算在前端展示。
    但是由于Domain95BandwidthV2这个接口需要range>600s,所以可设置rangeTime=1200delayTime=600,能够取到比较精确的值
  2. 在httpCodeRate部分,原有逻辑为取区间、累加、平均,但由于取状态码部分代码固定,导致计算不准确。
    例如,状态码499、回源状态码418这些实际上是有相当的比例的,但是没有计算。
    改为使用反射,从sdk定义的HttpCodeV2Detail结构体取属性进行计算,并在最后过滤掉数值为0的状态码减少干扰。
    使用反射可能会带来一定的性能开销,但是完全可以接受

@DDDFiish DDDFiish marked this pull request as draft April 15, 2025 03:35
@DDDFiish DDDFiish marked this pull request as ready for review April 15, 2025 03:35
@LeoQuote LeoQuote merged commit 6cac9d8 into douban:main Apr 15, 2025
2 checks passed
@DDDFiish DDDFiish deleted the ucloud-exporter-patch branch April 15, 2025 08:24
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