File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ Frequently Asked Questions and Cookbook
2
+ =======================================
3
+
4
+ This page answers frequently asked questions, and serves as a cookbook
5
+ for common scenarios.
6
+
7
+ Create a new span
8
+ -----------------
9
+
10
+ .. code-block :: python
11
+
12
+ from opentelemetry import trace
13
+
14
+ tracer = trace.get_tracer(__name__ )
15
+ with tracer.start_as_current_span(" print" ) as span:
16
+ print (" foo" )
17
+ span.set_attribute(" printed_string" , " foo" )
18
+
19
+ Getting and modifying a span
20
+ ----------------------------
21
+
22
+ .. code-block :: python
23
+
24
+ from opentelemetry import trace
25
+
26
+ current_span = trace.get_current_span()
27
+ current_span.set_attribute(" hometown" , " seattle" )
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ install <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>
62
62
:name: getting-started
63
63
64
64
getting-started
65
+ faq-and-cookbook
65
66
66
67
.. toctree ::
67
68
:maxdepth: 1
You can’t perform that action at this time.
0 commit comments