Skip to content

Commit

Permalink
perf: Only generate default resource for root span
Browse files Browse the repository at this point in the history
  • Loading branch information
PROFeNoM committed Apr 2, 2024
1 parent e670e76 commit 06781bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/DDTrace/OpenTelemetry/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace OpenTelemetry\Context;

use DDTrace\RootSpanData;
use DDTrace\SpanData;
use DDTrace\Tag;
use DDTrace\Util\ObjectKVStore;
Expand Down Expand Up @@ -197,7 +198,7 @@ private static function activateParent(?SpanData $currentSpan): ContextInterface
API\Span::fromContext($parentContext), // $parentSpan (TODO: Handle null parent span) ?
$parentContext, // $parentContext
NoopSpanProcessor::getInstance(), // $spanProcessor
ResourceInfoFactory::defaultResource(), // $resource
($currentSpan->parent === null && $currentSpan instanceof RootSpanData) ? ResourceInfoFactory::defaultResource() : ResourceInfoFactory::emptyResource(), // $resource
[], // $attributesBuilder
$links, // $links
count($links), // $totalRecordedLinks
Expand Down

0 comments on commit 06781bc

Please sign in to comment.