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

Please see uptrace-python documentation for more details.

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

Uploaded Source

Built Distribution

uptrace-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uptrace-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for uptrace-1.0.0.tar.gz
Algorithm Hash digest
SHA256 98fb79a127f0888e9a655da88f10e7c1e7a38c1e789755d24bbeb803e532314e
MD5 e137b6630405579dd24497524627be50
BLAKE2b-256 4b99f2d4014c8c6bef3afec14c7ece5b63c555bfdbf44aa34ad590f9614f754e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uptrace-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for uptrace-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f008e6f44c4f55417df33ce1b7a8d3bb1adcda3f311f2f9dba1d92cf67ade27
MD5 5501058ddb7d7710722230e902d4f428
BLAKE2b-256 0a8ac2de965210a9240f60329265f8422c3b95468ed5b6cc571b55d79b648a7f

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