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()
Links
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.8.0.tar.gz
(6.0 kB
view details)
Built Distribution
File details
Details for the file uptrace-1.8.0.tar.gz
.
File metadata
- Download URL: uptrace-1.8.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 179d552200b6f92942e972e19b42929ebbbb2f7ab0ccd74c0548be2ad8d2ff4a |
|
MD5 | f6d9ed7585da949484e37ddd212b4abe |
|
BLAKE2b-256 | 9025a88a8169a333cadb6289f293903f84e0f84b43aac803cb62067cc5dde920 |
File details
Details for the file uptrace-1.8.0-py3-none-any.whl
.
File metadata
- Download URL: uptrace-1.8.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c92f97fcf44be085b3417135e4ac361096c675ec43ac13d8ff4a4b2f01264e27 |
|
MD5 | cb081294510aab105a310b9a2289c283 |
|
BLAKE2b-256 | 18155ed61e21083bd7e507020c2d3bffa40efbe704bae3eaeeab09ea50945d76 |