Skip to content

Commit 08ca9b1

Browse files
author
Kévin Liagre
committed
Use RUM header to allow distributed tracing
Regarding the ELK doc, we can use the header elastic-apm-traceparent as trace_id for spans and transactions to allow distributed tracing between our services.
1 parent 472efd2 commit 08ca9b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Wrappers/Traits/EventTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private function initContext(EventSharedData $sharedData) : Context
6969
{
7070
// Generate Random UUIDs
7171
$this->id = UID::Generate(16); //Uuid::uuid4()->toString();
72-
$this->trace_id = UID::Generate(16); //Uuid::uuid4()->toString();
72+
$this->trace_id = $this->trace_id = $_SERVER['HTTP_ELASTIC_APM_TRACEPARENT'] ? : UID::Generate(16); //Uuid::uuid4()->toString();
7373

7474
// Set Shared Context Variable for further use
7575
$this->sharedData = $sharedData;
@@ -354,4 +354,4 @@ final protected function getCookieHeader(string $cookieHeader) : string
354354
}
355355

356356

357-
}
357+
}

0 commit comments

Comments
 (0)