芝麻web文件管理V1.00
编辑当前文件:/home/sditechnicalteam/public_html/vendor/sentry/sentry/src/Tracing/GuzzleTracingMiddleware.php
getClient(); $span = $hub->getSpan(); if (null === $span) { return $handler($request, $options); } $spanContext = new SpanContext(); $spanContext->setOp('http.client'); $spanContext->setDescription($request->getMethod() . ' ' . $request->getUri()); $childSpan = $span->startChild($spanContext); $request = $request ->withHeader('sentry-trace', $childSpan->toTraceparent()); // Check if the request destination is allow listed in the trace_propagation_targets option. if (null !== $client) { $sdkOptions = $client->getOptions(); if (\in_array($request->getUri()->getHost(), $sdkOptions->getTracePropagationTargets())) { $request = $request ->withHeader('baggage', $childSpan->toBaggage()); } } $handlerPromiseCallback = static function ($responseOrException) use ($hub, $request, $childSpan) { // We finish the span (which means setting the span end timestamp) first to ensure the measured time // the span spans is as close to only the HTTP request time and do the data collection afterwards $childSpan->finish(); $response = null; /** @psalm-suppress UndefinedClass */ if ($responseOrException instanceof ResponseInterface) { $response = $responseOrException; } elseif ($responseOrException instanceof GuzzleRequestException) { $response = $responseOrException->getResponse(); } $breadcrumbData = [ 'url' => (string) $request->getUri(), 'method' => $request->getMethod(), 'request_body_size' => $request->getBody()->getSize(), ]; if (null !== $response) { $childSpan->setStatus(SpanStatus::createFromHttpStatusCode($response->getStatusCode())); $breadcrumbData['status_code'] = $response->getStatusCode(); $breadcrumbData['response_body_size'] = $response->getBody()->getSize(); } else { $childSpan->setStatus(SpanStatus::internalError()); } $hub->addBreadcrumb(new Breadcrumb( Breadcrumb::LEVEL_INFO, Breadcrumb::TYPE_HTTP, 'http', null, $breadcrumbData )); if ($responseOrException instanceof \Throwable) { throw $responseOrException; } return $responseOrException; }; return $handler($request, $options)->then($handlerPromiseCallback, $handlerPromiseCallback); }; }; } }