From 2e84a740f4ce3818c0bb5ab5d32e858cbae14034 Mon Sep 17 00:00:00 2001 From: Shueh Chou Lu Date: Thu, 1 Jul 2021 14:30:20 +0800 Subject: [PATCH] feat: useragent (#2) --- src/Collectors/SegmentCollector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Collectors/SegmentCollector.php b/src/Collectors/SegmentCollector.php index 57a196e..d9a2ca8 100644 --- a/src/Collectors/SegmentCollector.php +++ b/src/Collectors/SegmentCollector.php @@ -54,6 +54,7 @@ public function initHttpTracer(Request $request): void ->setName(config('xray.name') ?? config('app.name')) ->setClientIpAddress($request->ip()) ->setUrl($request->url()) + ->setUserAgent(substr($_SERVER['HTTP_USER_AGENT'] ?? '', 0, 300)) ->setMethod($request->method()); $tracer->begin($this->getSampleRate());