Registry / observability / opencensus-ext-sqlalchemy

opencensus-ext-sqlalchemy

JSON →
library0.1.3pypypiunverified

OpenCensus SQLAlchemy Integration provides tracing instrumentation for SQLAlchemy queries. It wraps SQLAlchemy engine events to capture spans for each executed query, including bind parameters and execution time. Version 0.1.3 is current, with irregular releases.

pip install opencensus-ext-sqlalchemy
INSTALL
IMPORT
SIG · OPENCENSUS-EXT-SQL
O
opencensus-ext-sqlalchemy
observabilitypythonv0.1.3
Install
7.2s avg
Import
Disk
59MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 59.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 7.2s · import 0.000s · 60MB
59MB installed
● package 59MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SQLAlchemyTrace
from opencensus.ext.sqlalchemy import SQLAlchemyTrace
from opencensus.ext.sqlalchemy.trace import SQLAlchemyTrace

Instrument a SQLAlchemy engine to trace queries.

import os from opencensus.ext.sqlalchemy.trace import SQLAlchemyTrace from sqlalchemy import create_engine # Create engine engine = create_engine('sqlite:///:memory:') # Instrument with OpenCensus tracer tracer = SQLAlchemyTrace(engine) # Now every query executed via this engine will be traced with engine.connect() as conn: conn.execute("SELECT 1")
Debug
Known issues
gotchaSQLAlchemyTrace must wrap the engine before any queries are executed. Instrumentation after connections have been created will not capture traces for those connections.
fix
Apply SQLAlchemyTrace immediately after engine creation, before first use.
affects: all
gotchaThe package does not automatically export traces; you must configure an exporter (e.g., Azure Monitor, Zipkin) via OpenCensus tracing. Without an exporter, no data is sent anywhere.
fix
Set up OpenCensus tracing with an exporter, e.g., 'from opencensus.trace import tracer as tracer_module' and configure with a sampler and exporter.
affects: all
deprecatedOpenCensus Python is in maintenance mode and no longer actively developed. Google recommends using OpenTelemetry instead. However, the extension still works for existing users.
fix
Migrate to OpenTelemetry with opentelemetry-instrumentation-sqlalchemy.
affects: >=0.11.0
Upgrade
Version history
0.1.3latest on PyPI · released Oct 5, 2021
Audit
Dependencies
opencensusrequiredCore OpenCensus library for tracing and exporting
sqlalchemyrequiredInstrumented ORM/engine
opencensus-ext-azureoptionalExport traces to Azure Monitor (common exporter)
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
2
Resources
opencensus-ext-sqlalchemy — pip install opencensus-ext-sqlalchemy · libregistry