Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 5 additions & 31 deletions docs/en/components/telescope.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,11 @@ php bin/hyperf.php migrate

## Usage

> Choose either the listener or middleware
### Middleware (Optional for gRPC)

### Request Listener
Add the middleware in the `config/autoload/middlewares.php` configuration file

Add the listener in the `config/autoload/listeners.php` configuration file

```php
<?php

return [
FriendsOfHyperf\Telescope\Listener\RequestHandledListener::class,
FriendsOfHyperf\Telescope\Listener\SetRequestLifecycleListener::class,
];

```

### Middleware

Add the global middleware in the `config/autoload/middlewares.php` configuration file

To record HTTP requests, use the `http` middleware

```php
<?php

return [
'http' => [
FriendsOfHyperf\Telescope\Middleware\TelescopeMiddleware::class,
],
];
```

To record gRPC requests, use the `grpc` middleware
To enable additional gRPC functionality, use the `grpc` middleware

```php
<?php
Expand All @@ -78,6 +50,8 @@ return [
];
```

> Note: Request tracking is automatically enabled via the RequestHandledListener. The TelescopeMiddleware is only needed for additional gRPC-specific functionality.

## View Dashboard

`http://127.0.0.1:9501/telescope`
Expand Down
36 changes: 5 additions & 31 deletions docs/zh-cn/components/telescope.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,11 @@ php bin/hyperf.php migrate

## 使用

> 监听器和中间件,二选一即可
### 中间件(可选,仅用于gRPC)

### 请求监听器
在 `config/autoload/middlewares.php`配置文件加上中间件

在 `config/autoload/listeners.php`配置文件添加监听器

```php
<?php

return [
FriendsOfHyperf\Telescope\Listener\RequestHandledListener::class,
FriendsOfHyperf\Telescope\Listener\SetRequestLifecycleListener::class,
];

```

### 中间件

在 `config/autoload/middlewares.php`配置文件加上全局中间件

如需记录http请求,请使用`http`中间件

```php
<?php

return [
'http' => [
FriendsOfHyperf\Telescope\Middleware\TelescopeMiddleware::class,
],
];
```

如需记录gRPC请求,请使用`grpc`中间件
如需gRPC的额外功能,请使用`grpc`中间件

```php
<?php
Expand All @@ -78,6 +50,8 @@ return [
];
```

> 注意: 请求跟踪功能已通过 RequestHandledListener 自动启用。TelescopeMiddleware 仅用于 gRPC 的额外功能。

## 查看仪表板

`http://127.0.0.1:9501/telescope`
Expand Down
36 changes: 5 additions & 31 deletions docs/zh-hk/components/telescope.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,11 @@ php bin/hyperf.php migrate

## 使用

> 監聽器和中間件,二選一即可
### 中間件(可選,僅用於gRPC)

### 請求監聽器
在 `config/autoload/middlewares.php`配置文件加上中間件

在 `config/autoload/listeners.php`配置文件添加監聽器

```php
<?php

return [
FriendsOfHyperf\Telescope\Listener\RequestHandledListener::class,
FriendsOfHyperf\Telescope\Listener\SetRequestLifecycleListener::class,
];

```

### 中間件

在 `config/autoload/middlewares.php`配置文件加上全局中間件

如需記錄http請求,請使用`http`中間件

```php
<?php

return [
'http' => [
FriendsOfHyperf\Telescope\Middleware\TelescopeMiddleware::class,
],
];
```

如需記錄gRPC請求,請使用`grpc`中間件
如需gRPC的額外功能,請使用`grpc`中間件

```php
<?php
Expand All @@ -78,6 +50,8 @@ return [
];
```

> 注意: 請求追蹤功能已通過 RequestHandledListener 自動啟用。TelescopeMiddleware 僅用於 gRPC 的額外功能。

## 查看儀表板

`http://127.0.0.1:9501/telescope`
Expand Down
36 changes: 5 additions & 31 deletions docs/zh-tw/components/telescope.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,11 @@ php bin/hyperf.php migrate

## 使用

> 監聽器和中介軟體,二選一即可
### 中介軟體(可選,僅用於gRPC)

### 請求監聽器
在 `config/autoload/middlewares.php`配置檔案加上中介軟體

在 `config/autoload/listeners.php`配置檔案新增監聽器

```php
<?php

return [
FriendsOfHyperf\Telescope\Listener\RequestHandledListener::class,
FriendsOfHyperf\Telescope\Listener\SetRequestLifecycleListener::class,
];

```

### 中介軟體

在 `config/autoload/middlewares.php`配置檔案加上全域性中介軟體

如需記錄http請求,請使用`http`中介軟體

```php
<?php

return [
'http' => [
FriendsOfHyperf\Telescope\Middleware\TelescopeMiddleware::class,
],
];
```

如需記錄gRPC請求,請使用`grpc`中介軟體
如需gRPC的額外功能,請使用`grpc`中介軟體

```php
<?php
Expand All @@ -78,6 +50,8 @@ return [
];
```

> 注意: 請求追蹤功能已透過 RequestHandledListener 自動啟用。TelescopeMiddleware 僅用於 gRPC 的額外功能。

## 檢視儀表板

`http://127.0.0.1:9501/telescope`
Expand Down
18 changes: 2 additions & 16 deletions src/telescope/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,7 @@ php bin/hyperf.php vendor:publish friendsofhyperf/telescope
php bin/hyperf.php migrate
```

## Add Listener

```php
<?php

// config/autoload/listeners.php

return [
FriendsOfHyperf\Telescope\Listener\SetRequestLifecycleListener::class,
FriendsOfHyperf\Telescope\Listener\RequestHandledListener::class,
];

```

## Add Middleware
## Add Middleware (Optional for gRPC)

```php
<?php
Expand All @@ -68,7 +54,7 @@ return [

```

> TelescopeMiddleware or RequestHandledListener, you can choose one of them.
> Note: Request tracking is automatically enabled via the RequestHandledListener. The TelescopeMiddleware is only needed for additional gRPC-specific functionality.

## Add env

Expand Down
2 changes: 2 additions & 0 deletions src/telescope/src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function __invoke(): array
Listener\FetchRecordingOnBootListener::class,
Listener\RedisCommandExecutedListener::class,
Listener\RegisterRoutesListener::class => -1,
Listener\RequestHandledListener::class,
Listener\SetRequestLifecycleListener::class,
Comment on lines +51 to +52
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description mentions adding a ConfigProviderTest to verify all required listeners are registered, but no test file is included in this pull request. Adding test coverage would help ensure these critical listeners remain registered in future changes and prevent regression of the bug this PR fixes.

Copilot uses AI. Check for mistakes.
],
'publish' => [
[
Expand Down