webman,安装 ARMS 插件报错

evilk

PHP 版本 = 7.3.33
执行命令 composer require webman/arms

Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - webman/arms[v1.0.2, ..., v1.0.3] require openzipkin/zipkin ^3.0 -> satisfiable by openzipkin/zipkin[3.0.0].
    - openzipkin/zipkin 3.0.0 requires php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement.
    - Root composer.json requires webman/arms ^1.0 -> satisfiable by webman/arms[v1.0.2, v1.0.3].

webman/arms/composer.json

{
  "name": "webman/arms",
  "type": "library",
  "license": "MIT",
  "require": {
    "php": ">=7.2",
    "openzipkin/zipkin": "^3.0"
  },
  "autoload": {
    "psr-4": {
      "Webman\\Arms\\": "src"
    }
  }
}

openzipkin/zipkin": "^3.0最低要求 php7.4

老大,能否把webman/arms/composer.json中的zipkin版本降低一个版本
这样可能会引起误导

1328 2 0
2个回答

walkor 打赏

已经降低openzipkin/zipkin版本要求,再试下

evilk

顺带问一下,这个ARMS插件,能上报异常吗?
因为我们在代码中,自己接管了异常

  • walkor 2022-04-19

    好像没上报异常,如有需要,欢迎发pr

  • evilk 2022-04-19

    我们最近2天,马上就要上线这个项目了,希望能尽快完善这个插件
    非常感谢老大

  • walkor 2022-04-19

    我的意思是有需要可以自己加上,然后发pr,这边合并代码

  • evilk 2022-04-19

    好的
    谢谢
    我看看,阿里云的文档,如何上报异常

  • evilk 2022-04-19

    问一下
    是不是应该在我们接管异常的那个地方,加上这段代码

    if (!$tracing) {
                $endpoint = Endpoint::create(config('plugin.webman.arms.app.app_name'), $request->getRealIp(), null, 2555);
                $logger = new \Monolog\Logger('log');
                $logger->pushHandler(new \Monolog\Handler\ErrorLogHandler());
                $reporter = new \Zipkin\Reporters\Http([
                    'endpoint_url' => config('plugin.webman.arms.app.endpoint_url')
                ]);
                $sampler = BinarySampler::createAsAlwaysSample();
                $tracing = TracingBuilder::create()
                    ->havingLocalEndpoint($endpoint)
                    ->havingSampler($sampler)
                    ->havingReporter($reporter)
                    ->build();
                $tracer = $tracing->getTracer();
                // 30秒上报一次,尽量将上报对业务的影响减少到最低
                Timer::add(30, function () use ($tracer) {
                    $tracer->flush();
                });
                register_shutdown_function(function () use ($tracer) {
                    $tracer->flush();
                });
    
                if (class_exists('\Illuminate\Database\Events\QueryExecuted')) {
                    Db::listen(function (\Illuminate\Database\Events\QueryExecuted $query) {
                        $rootSpan = request()->rootSpan ?? null;
                        if ($rootSpan) {
                            $rootSpan->tag('db.statement', $query->sql . " /*{$query->time}ms*/");
                        }
                    });
                }
            }
    
            $rootSpan = $tracer->newTrace();
            $rootSpan->setName($request->controller . "::" . $request->action);
            $rootSpan->start();
            $request->rootSpan = $rootSpan;
            $result = $next($request);
    
            if (class_exists(\think\facade\Db::class)) {
                $logs = \think\facade\Db::getDbLog(true);
                if (!empty($logs['sql'])) {
                    foreach ($logs['sql'] as $sql) {
                        $rootSpan->tag('db.statement', $sql);
                    }
                }
            }
    
            $rootSpan->finish();
    
            return $result;
  • evilk 2022-04-19

    老大
    当前进程上报期间,是不是会阻塞当前这个进程?
    无法处理其他正常请求?

  • walkor 2022-04-19

年代过于久远,无法发表回答
×
🔝