File: README.md

package info (click to toggle)
python-opentracing 2.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 816 kB
  • sloc: python: 3,489; makefile: 98
file content (18 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Active Span replacement example.

This example shows a `Span` being created and then passed to an asynchronous task, which will temporary activate it to finish its processing, and further restore the previously active `Span`.

`threading` implementation:
```python
# Create a new Span for this task
with self.tracer.start_active_span('task'):

    with self.tracer.scope_manager.activate(span, True):
	# Simulate work strictly related to the initial Span
	pass

    # Use the task span as parent of a new subtask
    with self.tracer.start_active_span('subtask'):
	pass

```