Uptrace client for Python
Project description
Uptrace for Python
Installation
Introduction
uptrace-python is an OpenTelemery distribution configured to export traces to Uptrace.
Quickstart
Install uptrace-python:
pip install uptrace
Run the basic example below using the DSN from the Uptrace project settings page.
#!/usr/bin/env python3
import uptrace
from opentelemetry import trace
# Set dsn or UPTRACE_DSN env var.
uptrace.configure_opentelemetry(
dsn="", service_name="myservice", service_version="1.0.0"
)
tracer = trace.get_tracer("app_or_package_name", "1.0.0")
with tracer.start_as_current_span("main") as span:
with tracer.start_as_current_span("child1") as span:
span.set_attribute("key1", "value1")
span.record_exception(ValueError("error1"))
with tracer.start_as_current_span("child2") as span:
span.set_attribute("key2", "value2")
span.set_attribute("key3", 123.456)
print("trace:", uptrace.trace_url(span))
# Send buffered spans.
trace.get_tracer_provider().shutdown()
Please see uptrace-python documentation for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uptrace-1.0.0rc3.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for uptrace-1.0.0rc3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7e627a93875e1357bc6feb6333f0c9caef4a59e4651eb47765e8381cfe666c6 |
|
MD5 | bd4c3d41726575c66ef36b2bcf316296 |
|
BLAKE2b-256 | 31e901b410c3eaecddb144a7af93772839c7d50dd79b84b5165cc7994c1e2cf4 |