OpenTelemetry Starlette Instrumentation
Project description
This library provides automatic and manual instrumentation of Starlette web frameworks, instrumenting http requests served by applications utilizing the framework.
auto-instrumentation using the opentelemetry-instrumentation package is also supported.
Installation
pip install opentelemetry-instrumentation-starlette
Configuration
Exclude lists
To exclude certain URLs from being tracked, set the environment variable OTEL_PYTHON_STARLETTE_EXCLUDED_URLS with comma delimited regexes representing which URLs to exclude.
For example,
export OTEL_PYTHON_STARLETTE_EXCLUDED_URLS="client/.*/info,healthcheck"
will exclude requests such as https://site/client/123/info and https://site/xyz/healthcheck.
Usage
from opentelemetry.instrumentation.starlette import StarletteInstrumentor
from starlette import applications
from starlette.responses import PlainTextResponse
from starlette.routing import Route
def home(request):
return PlainTextResponse("hi")
app = applications.Starlette(
routes=[Route("/foobar", home)]
)
StarletteInstrumentor.instrument_app(app)
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for opentelemetry_instrumentation_starlette-0.18b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99a2ebe664be2b50a5d4a7e730e32dc7190eb7c73bbca34d8d74a4f042ce288d |
|
MD5 | becf4dbf625a882c0c7f2590cf1ff14f |
|
BLAKE2b-256 | cfa7a4525da7d6c94d26263a64c13bdd935d3d41bc219331a2285b3581a7d742 |