使用 Redis 存储指标时报错

Open
#16 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php, prometheus, redis

Research direction

Start with config/autoload/dependencies.php and the Redis implementation at vendor/hyperf/metric/src/Adapter/Prometheus/Redis.php. Reproduce the framework startup using the RedisStorageFactory configuration and inspect the Adapter contract named in the fatal error. Done means the Redis-backed metrics configuration starts without the reported abstract-method failure.

Written by the indexing model from the issue text.

Description

在config/autoload/dependencies.php 中更换为 Redis 存储:

return [
    Prometheus\Storage\Adapter::class => Hyperf\Metric\Adapter\Prometheus\RedisStorageFactory::class,
];

启动框架报错:
PHP Fatal error: Class Hyperf\Metric\Adapter\Prometheus\Redis contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Prometheus\Storage\Adapter::updateSummary) in /srv/hyperf/vendor/hyperf/metric/src/Adapter/Prometheus/Redis.php on line 24

Dominant language
PHP
Stars
5
Forks
15
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hyperf/metric

All issues in hyperf/metric

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.