-
Notifications
You must be signed in to change notification settings - Fork 438
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
Update readthedocs api guide: nested spans and context propagator #792
Update readthedocs api guide: nested spans and context propagator #792
Conversation
Codecov Report
@@ Coverage Diff @@
## main #792 +/- ##
=======================================
Coverage 96.00% 96.00%
=======================================
Files 176 176
Lines 7186 7186
=======================================
Hits 6899 6899
Misses 287 287 |
@@ -48,5 +48,57 @@ related span is ended. | |||
|
|||
The concept of an active span is important, as any span that is created | |||
without explicitly specifying a parent is parented to the currently | |||
active span. | |||
active span. A span without a parent is called root span. |
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.
active span. A span without a parent is called root span. | |
active span. A span with a null parent is called root span. |
auto inner_span = tracer->StartSpan("Inner operation"); | ||
auto inner_scope = tracer->WithActiveSpan(inner_span); | ||
// ... perform inner operation | ||
inner_span->End(); |
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.
Is this call to ->End()
optional? The destruction of inner_span
would call End()
.
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.
It's optional, as ~Span destructor calls it anyway. But the Span
object returned by Tracer::StartSpan
is shared_ptr and in case instrumentation code is referring to this object at some other places, the ~Span destructor will be called when all the references are cleaned up. It's always good ( and no harm ) to call it explicitly to export the Span when it is complete. And later when the destructor is called, it won't perform this again.
Added Nested spans and Context Propagation in API Getting started guide.
Here is how it looks like:
https://labhas-opentelemetry-cpp.readthedocs.io/en/latest/GettingStarted.html
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes