-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding an FAQ section, which can also serve as a quick reference. Not having such a section makes common scenarios harder to discover.
- Loading branch information
1 parent
4726bbf
commit 272bc0e
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Frequently Asked Questions and Cookbook | ||
======================================= | ||
|
||
This page answers frequently asked questions, and serves as a cookbook | ||
for common scenarios. | ||
|
||
Create a new span | ||
----------------- | ||
|
||
.. code-block:: python | ||
from opentelemetry import trace | ||
tracer = trace.get_tracer(__name__) | ||
with tracer.start_as_current_span("print") as span: | ||
print("foo") | ||
span.set_attribute("printed_string", "foo") | ||
Getting and modifying a span | ||
---------------------------- | ||
|
||
.. code-block:: python | ||
from opentelemetry import trace | ||
current_span = trace.get_current_span() | ||
current_span.set_attribute("hometown", "seattle") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters