Skip to main content

OpenTelemetry Python distribution for Uptrace

Project description

Uptrace for Python

build workflow Documentation Chat

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


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

Uploaded Source

Built Distribution

uptrace-1.16.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uptrace-1.16.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for uptrace-1.16.0.tar.gz
Algorithm Hash digest
SHA256 ae5b044a713eeaa1f1acd2768d9fbea43ccf91cfba18fb8a805c8d339525179d
MD5 3a53e4250b09b0266e86a36d32004572
BLAKE2b-256 4ef15495eca0c9c6ee427835ce8a526391bd23ae2e602df4c484d70e84642394

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uptrace-1.16.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for uptrace-1.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87708632bcf64c4b5f845bf825e40f51a5b3b816aadd7a98ac782fd01fdb5b79
MD5 710675019f6afaf2904694162130207b
BLAKE2b-256 abaec0306ec034c7aca9c882cdd85706ab37bf8847b65048265570700368fe69

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