Closed assoyuan closed 1 year ago
添加MetricMiddleware中间件后,项目压测的qps下降了一半。但移除中间件后,grafana又收不到监控。
请问是用法不对吗?是否需要添加中间件呢?
metric配置文件
return [ // To disable hyperf/metric temporarily, set default driver to noop. 'default' => env('METRIC_DRIVER', 'prometheus'), 'use_standalone_process' => env('METRIC_USE_STANDALONE_PROCESS', true), 'enable_default_metric' => env('METRIC_ENABLE_DEFAULT_METRIC', true), 'default_metric_interval' => env('DEFAULT_METRIC_INTERVAL', 5), 'metric' => [ 'prometheus' => [ 'driver' => Hyperf\Metric\Adapter\Prometheus\MetricFactory::class, 'mode' => Constants::SCRAPE_MODE, 'namespace' => env('APP_NAME', 'skeleton'), 'scrape_host' => env('PROMETHEUS_SCRAPE_HOST', '0.0.0.0'), 'scrape_port' => env('PROMETHEUS_SCRAPE_PORT', '9502'), 'scrape_path' => env('PROMETHEUS_SCRAPE_PATH', '/metrics'), 'push_host' => env('PROMETHEUS_PUSH_HOST', '0.0.0.0'), 'push_port' => env('PROMETHEUS_PUSH_PORT', '9091'), 'push_interval' => env('PROMETHEUS_PUSH_INTERVAL', 5), ], 'noop' => [ 'driver' => Hyperf\Metric\Adapter\NoOp\MetricFactory::class, ], ], ];
环境:
php7.4 hyperf 2.0 metric 2.0
添加MetricMiddleware中间件后,项目压测的qps下降了一半。但移除中间件后,grafana又收不到监控。
请问是用法不对吗?是否需要添加中间件呢?
metric配置文件
环境: