-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Both traceparent&servertiming for CodeIgniter, Yii, Laravel (#230)
- Loading branch information
1 parent
d377253
commit 87e14e3
Showing
2 changed files
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Contrib\Instrumentation\Laravel; | ||
|
||
use function assert; | ||
use Illuminate\Http\Response; | ||
use OpenTelemetry\Context\Propagation\PropagationSetterInterface; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
class ResponsePropagationSetter implements PropagationSetterInterface | ||
{ | ||
public static function instance(): self | ||
{ | ||
static $instance; | ||
|
||
return $instance ??= new self(); | ||
} | ||
|
||
public function set(&$carrier, string $key, string $value): void | ||
{ | ||
assert($carrier instanceof Response); | ||
|
||
$carrier->headers->set($key, $value); | ||
} | ||
} |