Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add PDO spans to orphans removal #2743

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/DDTrace/Integrations/PDO/PDOIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function init(): int

// public PDO::__construct ( string $dsn [, string $username [, string $passwd [, array $options ]]] )
\DDTrace\trace_method('PDO', '__construct', function (SpanData $span, array $args) {
Integration::handleOrphan($span);
$span->name = $span->resource = 'PDO.__construct';
$connectionMetadata = PDOIntegration::extractConnectionMetadata($args);
ObjectKVStore::put($this, PDOIntegration::CONNECTION_TAGS_KEY, $connectionMetadata);
Expand All @@ -58,6 +59,7 @@ public function init(): int
list($query) = $hook->args;

$span = $hook->span();
Integration::handleOrphan($span);
$span->name = 'PDO.exec';
$span->resource = Integration::toString($query);
$span->peerServiceSources = DatabaseIntegrationHelper::PEER_SERVICE_SOURCES;
Expand Down Expand Up @@ -103,6 +105,7 @@ public function init(): int
list($query) = $hook->args;

$span = $hook->span();
Integration::handleOrphan($span);
$span->name = 'PDO.prepare';
$span->resource = Integration::toString($query);
PDOIntegration::setCommonSpanInfo($this, $span);
Expand All @@ -114,6 +117,7 @@ public function init(): int

// public bool PDO::commit ( void )
\DDTrace\trace_method('PDO', 'commit', function (SpanData $span) {
Integration::handleOrphan($span);
$span->name = $span->resource = 'PDO.commit';
PDOIntegration::setCommonSpanInfo($this, $span);
});
Expand All @@ -123,6 +127,7 @@ public function init(): int
'PDOStatement',
'execute',
function (SpanData $span, array $args, $retval) use ($integration) {
Integration::handleOrphan($span);
$span->name = 'PDOStatement.execute';
Integration::handleInternalSpanServiceName($span, PDOIntegration::NAME);
$span->type = Type::SQL;
Expand Down
Loading