Skip to content

Commit

Permalink
Fix the bug that TracingRequestListener is not working (#462)
Browse files Browse the repository at this point in the history
Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia committed Nov 24, 2023
1 parent d4536b9 commit 4b68ed5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 37 deletions.
44 changes: 9 additions & 35 deletions src/sentry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,6 @@ composer require friendsofhyperf/sentry
php bin/hyperf.php vendor:publish friendsofhyperf/sentry
```

## Enable Request Lifecycle

> will auto config in `SetRequestLifecycleListener.php`
```php
# config/autoload/server.php
return [
// ...
'servers' => [
[
'name' => 'http',
'type' => Server::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 9501,
'callbacks' => [
Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
],
'options' => [
'enable_request_lifecycle' => true,
],
],
],
// ...
];
```

## Register Logger Handler

```php
Expand Down Expand Up @@ -106,20 +80,20 @@ class Foo
}
```

## Trace
## Tracing

```php
<?php

# config/autoload/middleware.php
# config/autoload/listeners.php
return [
'http' => [
FriendsOfHyperf\Sentry\Tracing\Middleware\TraceMiddleware::class => PHP_INT_MAX,
],
// rpc
// 'rpc' => [
// FriendsOfHyperf\Sentry\Tracing\Middleware\TraceMiddleware::class,
// ],
FriendsOfHyperf\Sentry\Tracing\Listener\TracingAmqpListener::class,
FriendsOfHyperf\Sentry\Tracing\Listener\TracingAsyncQueueListener::class,
FriendsOfHyperf\Sentry\Tracing\Listener\TracingCommandListener::class,
FriendsOfHyperf\Sentry\Tracing\Listener\TracingCrontabListener::class,
FriendsOfHyperf\Sentry\Tracing\Listener\TracingDbQueryListener::class,
FriendsOfHyperf\Sentry\Tracing\Listener\TracingKafkaListener::class,
FriendsOfHyperf\Sentry\Tracing\Listener\TracingRequestListener::class,
];
```

Expand Down
1 change: 0 additions & 1 deletion src/sentry/publish/sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
'guzzle' => env('SENTRY_TRACING_ENABLE_GUZZLE', true),
'rpc' => env('SENTRY_TRACING_ENABLE_RPC', true),
'redis' => env('SENTRY_TRACING_ENABLE_REDIS', true),
'request' => env('SENTRY_TRACING_ENABLE_REQUEST', true),
'sql_queries' => env('SENTRY_TRACING_ENABLE_SQL_QUERIES', true),
'missing_routes' => env('SENTRY_TRACING_ENABLE_MISSING_ROUTES', true),
],
Expand Down
1 change: 0 additions & 1 deletion src/sentry/src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function __invoke(): array
Listener\RequestExceptionListener::class,
Listener\SetRequestLifecycleListener::class,
Tracing\Listener\TracingDbQueryListener::class,
Tracing\Listener\TracingRequestListener::class,
],
'annotations' => [
'scan' => [
Expand Down

0 comments on commit 4b68ed5

Please sign in to comment.