OpenTelemetry Python distribution for Uptrace
Project description
Uptrace for Python
Introduction
uptrace-python is an OpenTelemery distribution configured to export traces and metrics 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.13.0.tar.gz
(7.1 kB
view details)
Built Distribution
File details
Details for the file uptrace-1.13.0.tar.gz
.
File metadata
- Download URL: uptrace-1.13.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4e0d1fe00e49ac47e24c76011a684a3dc225b5e7e5e3a75fa2054331529f68f |
|
MD5 | d08ba35e6ece04c7bd8aef144c62e060 |
|
BLAKE2b-256 | 4fea46111146252eb20708f7a5bc958ecd1c7af4a29114c2a34dbe16385a12c3 |
File details
Details for the file uptrace-1.13.0-py3-none-any.whl
.
File metadata
- Download URL: uptrace-1.13.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3992b23770874f670b730ef35f288c6a6ee47ae0f86425bd3e7ce3f6d66251d3 |
|
MD5 | e0ebde621676304ffdb38217ae8bf484 |
|
BLAKE2b-256 | bdcaeaadc505626f9fba4630df8a19463d9ffb88e4b348dd6349de1879cc84a9 |