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

Optimized the code of Hyperf\Metric\Adapter\Prometheus\Redis which allowed to rewrite the prefix about redis keys. #5702

Merged
merged 25 commits into from
May 18, 2023

Conversation

yansongda
Copy link
Contributor

@yansongda yansongda commented May 7, 2023

  • PROMETHEUS_REDIS_GATHER_KEY_SUFFIX 与 PROMETHEUS_REDIS_SUFFIX 做成可配置项
  • 优化重构 Prometheus 的 Redis Adapter 代码
  • 增加单元测试

@yansongda yansongda changed the title refactor: 重构 prometheus adapter 「metric」refactor: 重构 prometheus adapter May 7, 2023
@yansongda yansongda changed the title 「metric」refactor: 重构 prometheus adapter 「metric」「BC」refactor: 重构 prometheus adapter May 7, 2023
@limingxinleo
Copy link
Member

有办法做到不 BC 么?

@limingxinleo
Copy link
Member

比如做成配置项,定义出来,默认值是以前的,新版的可以自定义,然后 3.1 版本,再都换成新的统一的

@yansongda
Copy link
Contributor Author

比如做成配置项,定义出来,默认值是以前的,新版的可以自定义,然后 3.1 版本,再都换成新的统一的

有道理,我抽时间处理下

@yansongda yansongda marked this pull request as draft May 9, 2023 03:05
@limingxinleo limingxinleo added this to the v3.0 milestone May 10, 2023
@yansongda yansongda changed the title 「metric」「BC」refactor: 重构 prometheus adapter 「metric」refactor: 重构 prometheus adapter May 14, 2023
@yansongda yansongda marked this pull request as ready for review May 15, 2023 07:19
@yansongda
Copy link
Contributor Author

Ready for review

src/metric/src/Adapter/Prometheus/Redis.php Show resolved Hide resolved
src/metric/src/Adapter/Prometheus/Redis.php Outdated Show resolved Hide resolved
src/metric/src/Adapter/Prometheus/Redis.php Outdated Show resolved Hide resolved
@huangdijia huangdijia requested a review from assert6 May 15, 2023 14:19
@huangdijia
Copy link
Member

huangdijia commented May 15, 2023

https://github.com/PromPHP/prometheus_client_php/blob/main/src/Prometheus/Storage/Redis.php

不能直接用这个?

// RedisFactory
// \Prometheus\Storage\Redis::setPrefix(...);
// \Prometheus\Storage\Redis::setMetricGatherKeySuffix(...);

$redis = new \Prometheus\Storage\Redis();
(fun() => $this->redis = di(\Rdis::class))->call($redis);
return $redis;

@huangzhhui
Copy link
Member

奇怪这个为啥一直 CI 会过不了?有哪里错了吗?

@huangdijia
Copy link
Member

应该是没有rebase master分支

@limingxinleo limingxinleo changed the title 「metric」refactor: 重构 prometheus adapter Optimized the code of Hyperf\Metric\Adapter\Prometheus\Redis which allowed to rewrite the prefix about redis keys. May 18, 2023
@limingxinleo limingxinleo merged commit 2b2e939 into hyperf:master May 18, 2023
0 of 53 checks passed
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.

None yet

5 participants