Created
November 24, 2020 17:45
-
-
Save tedsuo/50e467bb3e71f0e7a705370c4fffa7e0 to your computer and use it in GitHub Desktop.
Python basic span lifecycle
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
# Start the span with a name and a parent span | |
child = tracer.start_span("my_operation", parent=parent) | |
try: | |
# pass the span around as a parameter | |
do_work(span=child) | |
finally: | |
# End the span, which measures the span duration and | |
# triggers the span data to be exported. | |
# WARNING: failing to end a span will create a leak. | |
child.end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment