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

Add root span/scope tracking #241

Merged
merged 6 commits into from
Jan 17, 2019
Merged

Add root span/scope tracking #241

merged 6 commits into from
Jan 17, 2019

Conversation

SammyK
Copy link
Contributor

@SammyK SammyK commented Jan 17, 2019

Description

This PR adds a way to track the root span so that it can be modified later in the script execution. This is important for integrations that don't have a way of hooking into the request/routing/etc early on in the script execution when the tracer is inited.

It works just like Tracer::startActiveSpan(), but it saves the Scope instance on the tracer to be accessed later by Tracer::getRootScope().

$tracer->startRootSpan('my_root_span');
// ...do lots of stuff...
$scope = $tracer->getRootScope();
// ..add tags and whatnot

Readiness checklist

@SammyK SammyK added 🏆 enhancement A new feature or improvement 🍏 core Changes to the core tracing functionality labels Jan 17, 2019
@SammyK SammyK added this to the 0.10.0 milestone Jan 17, 2019
@SammyK SammyK self-assigned this Jan 17, 2019
@SammyK SammyK requested a review from labbati January 17, 2019 15:08
Copy link
Member

@labbati labbati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea @SammyK , just left a few comments. 👍

src/DDTrace/Contracts/Tracer.php Outdated Show resolved Hide resolved
src/DDTrace/Tracer.php Outdated Show resolved Hide resolved
tests/Unit/TracerTest.php Outdated Show resolved Hide resolved
@SammyK SammyK changed the title Add root span tracking Add root span/scope tracking Jan 17, 2019
Copy link
Member

@labbati labbati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome I l ike it! Thanks @SammyK 🔝

@SammyK SammyK merged commit 8b6219f into dev Jan 17, 2019
@SammyK SammyK deleted the sammyk/add-root-span-tracking branch January 17, 2019 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍏 core Changes to the core tracing functionality 🏆 enhancement A new feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants