Skip to main content

Uptrace client for Python

Project description

Uptrace for Python

build workflow Documentation

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()

For more details, please see documentation and examples.

Project details


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.6.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

uptrace-1.6.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file uptrace-1.6.2.tar.gz.

File metadata

  • Download URL: uptrace-1.6.2.tar.gz
  • Upload date:
  • Size: 5.7 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

Hashes for uptrace-1.6.2.tar.gz
Algorithm Hash digest
SHA256 87a73e43916f49817b65e65b0925442385d6714b005ed8ab737e9e2c90ec2441
MD5 b6ba1c6e646b07924f44e8e82100a7db
BLAKE2b-256 b1462deab4b2a367ffb554f36ddeb32daa33c1848acb27c3b9028796c7afa591

See more details on using hashes here.

File details

Details for the file uptrace-1.6.2-py3-none-any.whl.

File metadata

  • Download URL: uptrace-1.6.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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

Hashes for uptrace-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1fb940493e5764442ec522378b6a96a4ee4ba8a145d6fec575549ff3d4278a77
MD5 a95b798e5df825125bbd148d5b0d43be
BLAKE2b-256 81628b2b7b475072e0990e4dda391898c2f63835d75b07e643db396f2dc3daf8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page