mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Fixed bug that server crash when tracer flush failed in defer. (#3228)
* Fixed bug that server crash when tracer flush failed in defer. * Update CHANGELOG-2.1.md
This commit is contained in:
parent
0bfb89fa1c
commit
80830d726f
@ -5,6 +5,7 @@
|
||||
- [#3204](https://github.com/hyperf/hyperf/pull/3204) Fixed unexpected behavior for `middlewares` when using `rpc-server`.
|
||||
- [#3209](https://github.com/hyperf/hyperf/pull/3209) Fixed bug that connection was not be released to pool when the amqp consumer broken in coroutine style server.
|
||||
- [#3222](https://github.com/hyperf/hyperf/pull/3222) Fixed memory leak for join queries in `hyperf/database`.
|
||||
- [#3228](https://github.com/hyperf/hyperf/pull/3228) Fixed bug that server crash when tracer flush failed in defer.
|
||||
|
||||
## Added
|
||||
|
||||
|
@ -25,25 +25,6 @@ composer require jonahgeorge/jaeger-client-php
|
||||
php bin/hyperf.php vendor:publish hyperf/tracer
|
||||
```
|
||||
|
||||
### opentracking/opentracking 版本申明
|
||||
|
||||
由于 [官方包](https://github.com/opentracing/opentracing-php) 最新版还是 `1.0.0-beta6`, 会导致 composer 安装时不符合 `minimum-stability`, 所以 hyperf 框架 fork 了一份, 并基于当前 master 分支打上 `v1.0.0` 版本
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
...
|
||||
"opentracing/opentracing":"1.0.0"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/hyperf/opentracing-php.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
### 配置
|
||||
@ -218,7 +199,7 @@ return [
|
||||
|
||||
### 配置 Span tag
|
||||
|
||||
`1.1.11` 版本后增加了 Span Tag 配置的功能,对于一些 Hyperf 自动收集追踪信息的 Span Tag 名称,可以通过更改 Span Tag 配置来更改对应的名称,只需在配置文件 `config/autolaod/opentracing.php` 内增加 `tags` 配置即可,参考配置如下。如配置项存在,则以配置项的值为准,如配置项不存在,则以组件的默认值为准。
|
||||
对于一些 Hyperf 自动收集追踪信息的 Span Tag 名称,可以通过更改 Span Tag 配置来更改对应的名称,只需在配置文件 `config/autolaod/opentracing.php` 内增加 `tags` 配置即可,参考配置如下。如配置项存在,则以配置项的值为准,如配置项不存在,则以组件的默认值为准。
|
||||
|
||||
```php
|
||||
return [
|
||||
|
@ -45,7 +45,10 @@ class TraceMiddleware implements MiddlewareInterface
|
||||
$span = $this->buildSpan($request);
|
||||
|
||||
defer(function () {
|
||||
$this->tracer->flush();
|
||||
try {
|
||||
$this->tracer->flush();
|
||||
} catch (\Throwable $exception) {
|
||||
}
|
||||
});
|
||||
try {
|
||||
$response = $handler->handle($request);
|
||||
|
Loading…
Reference in New Issue
Block a user