Skip to main content

Integration of comprehend.dev with OpenTelemetry in Python

Project description

comprehend-telemetry

OpenTelemetry integration for comprehend.dev - automatically capture and analyze your Python application's architecture and performance.

Installation

pip install comprehend-telemetry

Quick Start

Add the ComprehendDevSpanProcessor to your existing OpenTelemetry setup:

import os
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.resources import Resource
from comprehend_telemetry import ComprehendDevSpanProcessor

# Set up OpenTelemetry with your service information
resource = Resource.create({
    "service.name": "my-python-service",
    "service.namespace": "production",
    "deployment.environment": "prod"
})

tracer_provider = TracerProvider(resource=resource)

# Add comprehend.dev telemetry processor
if os.getenv("COMPREHEND_OBSERVATIONS_TOKEN"):
    comprehend_processor = ComprehendDevSpanProcessor(
        organization='comprehend',  # Use your organization name
        token=os.getenv("COMPREHEND_OBSERVATIONS_TOKEN"),
        debug=True  # Optional: enable debug logging
    )
    tracer_provider.add_span_processor(comprehend_processor)

# Set as global tracer provider
trace.set_tracer_provider(tracer_provider)

Configuration

Set your comprehend.dev ingestion token as an environment variable:

export COMPREHEND_OBSERVATIONS_TOKEN=your-ingestion-token-here

What it captures

This integration automatically captures:

  • HTTP Routes - API endpoints and their usage patterns
  • Database Operations - SQL queries with table operations analysis
  • Service Dependencies - HTTP client calls to external services
  • Performance Metrics - Request durations, response codes, error rates
  • Service Architecture - Automatically maps your service relationships

Requirements

  • Python 3.8+
  • OpenTelemetry SDK
  • An existing OpenTelemetry instrumentation setup

Framework Support

Works with any Python framework that supports OpenTelemetry auto-instrumentation:

  • FastAPI
  • Django
  • Flask
  • SQLAlchemy
  • Requests
  • HTTPx
  • And more...

Learn More

Development

See DEVELOPMENT.md for development setup and release instructions.

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

comprehend_telemetry-0.1.1.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

comprehend_telemetry-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file comprehend_telemetry-0.1.1.tar.gz.

File metadata

  • Download URL: comprehend_telemetry-0.1.1.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for comprehend_telemetry-0.1.1.tar.gz
Algorithm Hash digest
SHA256 871d608616a053e5afb0ed98b4366fac4ef2b907062f707b5cab8d789179ef5e
MD5 beb11ddf98bedffdd1fc4d8d4fd82773
BLAKE2b-256 1f6e1bdaa1623387a9de2abd4352fd02ace8a0694be6150c69fd3d0e3b3347a9

See more details on using hashes here.

File details

Details for the file comprehend_telemetry-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for comprehend_telemetry-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8add3241782445d76966ecf5b07e2630f995e3f0198ec3d5cea3adb048011c94
MD5 78816915bb607f3183b0c2ab543a8787
BLAKE2b-256 d0aebb3b8ecea872efb64c0c25bed8e4a0d666b06f47e638c5bc735ccf46e0d0

See more details on using hashes here.

Supported by

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