Is there a recommended compatible profiler for this library? #1143
Unanswered
drewgallagher
asked this question in
Q&A
Replies: 1 comment
-
Hi, I'm currently using sentry (tracing) with some adjustments to better track the different operations. It allows me to properly analyze the bottle cones and some load data of the operations (cache, ...), possibly also allows profiling. I don't know if this is enough for you, but I'll leave it to you anyway a quick resolver middleware snippet about the "adjustments" for better tracing the operations. namespace App\GraphQL\Middleware;
use Closure;
use GraphQL\Type\Definition\ResolveInfo;
use Rebing\GraphQL\Support\Middleware;
use Sentry\SentrySdk;
use Sentry\State\Scope;
use Sentry\Tracing\Transaction;
use function Sentry\configureScope;
class SentryContext extends Middleware
{
/**
* {@inheritdoc}
*/
public function handle($root, array $args, $context, ResolveInfo $info, Closure $next)
{
if (app()->bound('sentry')) {
configureScope(function (Scope $scope) use ($info): void {
$transaction = SentrySdk::getCurrentHub()->getTransaction();
if ($transaction instanceof Transaction) {
$transaction->setName("[GQL] {$info->operation->operation}.$info->fieldName");
}
$scope->setTag('app.gql.server_name', "{$info->operation->operation}.$info->fieldName");
$operationName = $info->operation->name?->value ?? null;
if (! empty($operationName)) {
$scope->setTag('app.gql.front_name', $operationName);
}
// ...do more...
if (auth()->check()) {
$scope->setUser(['id' => auth()->id()]);
}
});
}
return $next($root, $args, $context, $info);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I tried integrating Clockwork to profile our api however, I think it only tracks requests that are from the laravel router.
When I trigger api calls it does not track them using the chrome extension.
Is there another profiler that devs use for this library?
Beta Was this translation helpful? Give feedback.
All reactions