Skip to content

Commit

Permalink
docs: adding faq (#1068)
Browse files Browse the repository at this point in the history
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
toumorokoshi authored Sep 10, 2020
1 parent 4726bbf commit 272bc0e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/faq-and-cookbook.rst
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")
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
:name: getting-started

getting-started
faq-and-cookbook

.. toctree::
:maxdepth: 1
Expand Down

0 comments on commit 272bc0e

Please sign in to comment.