Skip to main content

Digma instrumentation for FastAPI

Project description

opentelemetry-instrumentation-digma-fastapi

Tests PyPI version

This package extends the default FastAPI instrumentation for OTEL to provide additional attributes which can be used to facilitate Continuous Feedback back to the code.

Installing the package

pip install opentelemetry-instrumentation-digma-fastapi

Or add it to your requirements/poetry file.

Instrumenting your FastAPI project

Enable OpenTelemetry in your project

First, configure OpenTelemetry in your project. See the Digma instrumentation repo for quick instructions on getting that done, whether you're already using OTEL or not.

Make sure you've instrumented your FastAPI application using the standard Pypi package.

  1. Install the package: pip install opentelemetry-instrumentation-fastapi
  2. Instrument the FastAPI app by adding the following to your app setup:
FastAPIInstrumentor.instrument_app(app) 

More info can be found in the official package documentation.

Enable the Digma OpenTelemetry instrumentation

Before or after the call to FastAPIInstrumentor.instrument to enable OTEL, also add the following:

DigmaFastAPIInstrumentor().instrument_app(app)

Check out some sample projects

You can review a simple example in the FastAPI Sample Repo Or a more complex real world example in the Gringotts Vault API application (which includes both FastAPI, Postgres, RabbitMQ and other technologies)

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

Built Distribution

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