Skip to content

Instantly share code, notes, and snippets.

@tedsuo
Created November 24, 2020 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedsuo/50e467bb3e71f0e7a705370c4fffa7e0 to your computer and use it in GitHub Desktop.
Save tedsuo/50e467bb3e71f0e7a705370c4fffa7e0 to your computer and use it in GitHub Desktop.
Python basic span lifecycle
# 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