-
Couldn't load subscription status.
- Fork 117
add Doctrine span links and more SemConv #374
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||
| <?php | ||||||
|
|
||||||
| declare(strict_types=1); | ||||||
|
|
||||||
| namespace OpenTelemetry\Contrib\Instrumentation\Doctrine; | ||||||
|
|
||||||
| use Doctrine\DBAL\Driver\Statement; | ||||||
| use OpenTelemetry\API\Trace\SpanContextInterface; | ||||||
| use WeakMap; | ||||||
| use WeakReference; | ||||||
|
|
||||||
| /** | ||||||
| * @internal | ||||||
| */ | ||||||
| class DoctrineTracker | ||||||
| { | ||||||
| private WeakMap $statementToSpanContextMap; | ||||||
|
|
||||||
| public function __construct() | ||||||
| { | ||||||
| $this->statementToSpanContextMap = new WeakMap(); | ||||||
| } | ||||||
|
|
||||||
| public function trackStatement(Statement $statement, SpanContextInterface $context): void | ||||||
| { | ||||||
| $this->statementToSpanContextMap[$statement] = WeakReference::create($context); | ||||||
|
||||||
| $this->statementToSpanContextMap[$statement] = WeakReference::create($context); | |
| $this->statementToSpanContextMap[$statement] = $context; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. I've used SplObjectStorage now, and added a test. It doesn't look like prepared statements can be destroyed easily, so I guess holding on to span context forever is okay...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should revert the WeakMap->SplObjectStorage change to avoid leaking memory; only the usage of WeakReference was problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted to WeakMap
Uh oh!
There was an error while loading. Please reload this page.