Skip to content

Commit

Permalink
Add ServerTimingPropagator
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricziel committed Nov 23, 2023
1 parent 2ddf2a5 commit d0888a4
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 373 deletions.
3 changes: 2 additions & 1 deletion src/Instrumentation/Symfony/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"symfony/http-client-contracts": "*"
},
"suggest": {
"open-telemetry/opentelemetry-propagation-traceresponse": "Automatically propagate the context to the client."
"open-telemetry/opentelemetry-propagation-server-timing": "Automatically propagate the context to the client through server-timing headers.",
"open-telemetry/opentelemetry-propagation-traceresponse": "Automatically propagate the context to the client through trace-response headers."
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
Expand Down
6 changes: 6 additions & 0 deletions src/Instrumentation/Symfony/src/SymfonyInstrumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public static function register(): void

$span->setAttribute(TraceAttributes::HTTP_RESPONSE_BODY_SIZE, $contentLength);

// Propagate server-timing header to response, if ServerTimingPropagator is present
if (class_exists('OpenTelemetry\Contrib\Propagation\ServerTiming\ServerTimingPropagator')) {
$prop = new \OpenTelemetry\Contrib\Propagation\ServerTiming\ServerTimingPropagator();
$prop->inject($response, ResponsePropagationSetter::instance(), $scope->context());
}

// Propagate traceresponse header to response, if TraceResponsePropagator is present
if (class_exists('OpenTelemetry\Contrib\Propagation\TraceResponse\TraceResponsePropagator')) {
$prop = new \OpenTelemetry\Contrib\Propagation\TraceResponse\TraceResponsePropagator();
Expand Down
12 changes: 0 additions & 12 deletions src/Propagation/ResponsePropagator/.gitattributes

This file was deleted.

1 change: 0 additions & 1 deletion src/Propagation/ResponsePropagator/.gitignore

This file was deleted.

43 changes: 0 additions & 43 deletions src/Propagation/ResponsePropagator/.php-cs-fixer.php

This file was deleted.

65 changes: 0 additions & 65 deletions src/Propagation/ResponsePropagator/README.md

This file was deleted.

39 changes: 0 additions & 39 deletions src/Propagation/ResponsePropagator/composer.json

This file was deleted.

9 changes: 0 additions & 9 deletions src/Propagation/ResponsePropagator/phpstan.neon.dist

This file was deleted.

44 changes: 0 additions & 44 deletions src/Propagation/ResponsePropagator/phpunit.xml.dist

This file was deleted.

15 changes: 0 additions & 15 deletions src/Propagation/ResponsePropagator/psalm.xml.dist

This file was deleted.

125 changes: 0 additions & 125 deletions src/Propagation/ResponsePropagator/tests/Unit/PropagatorTest.php

This file was deleted.

3 changes: 1 addition & 2 deletions src/Propagation/ServerTiming/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"prefer-stable": true,
"require": {
"php": "^7.0|^8.0",
"open-telemetry/context": "^1.0",
"open-telemetry/opentelemetry-propagation-response": "*"
"open-telemetry/context": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit d0888a4

Please sign in to comment.