-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conditional traceresponse propagation to Symfony auto-instrumenta…
…tion Add composer suggest dont mention x-ray CS Fix: Fix import order
- Loading branch information
1 parent
4ddd6e5
commit 06529d7
Showing
5 changed files
with
114 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/Instrumentation/Symfony/src/ResponsePropagationSetter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Contrib\Instrumentation\Symfony; | ||
|
||
use function assert; | ||
use OpenTelemetry\Context\Propagation\PropagationSetterInterface; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class ResponsePropagationSetter implements PropagationSetterInterface | ||
{ | ||
public static function instance(): self | ||
{ | ||
static $instance; | ||
|
||
return $instance ??= new self(); | ||
} | ||
|
||
/** @psalm-suppress InvalidReturnType */ | ||
public function keys($carrier): array | ||
{ | ||
assert($carrier instanceof Response); | ||
/** @psalm-suppress InvalidReturnStatement */ | ||
return $carrier->headers->keys(); | ||
} | ||
|
||
public function set(&$carrier, string $key, string $value): void | ||
{ | ||
assert($carrier instanceof Response); | ||
|
||
$carrier->headers->set($key, $value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters