Digma Quick Start
Guide for Python
COLLECT DATA FROM YOUR CODE!
Not yet on the OTEL train? No worries!
- Install the Digma opentelemetry pypi package:
pip install opentelemetry-instrumentation-digma
- Add the following quick bootstrap line to your code setup to bootstrap both OTEL and Digma:
from opentelemetry.instrumentation.digma import digma_opentelemetry_boostrap
digma_opentelemetry_boostrap(service_name='server-name',
digma_backend="http://localhost:5050",
configuration=DigmaConfiguration().trace_this_package())
If you’re already using OpenTelemetry…
- Add Digma to your collector:
Modify your collector configuration file to add Digma’s backend as a target. For example:
otlp/digma:
endpoint: "localhost:5050"
tls:
insecure: true
service:
pipelines:
traces:
exporters: [otlp/digma, ...]
- Connect Digma to your OTEL setup
Install the Digma opentelemetry pypi package:
pip install opentelemetry-instrumentation-digma
Or add to your requirements.txt file
Add the following line immediately after your OTEL resource object creation:
resource = resource.merge(DigmaConfiguration().trace_this_package()
Finally, connect your code to Digma!
Add one or two lines of code to instrument Digma based on the platform you are currently using.
Get More Out of Digma
To find out about adding environments, commit info and other configuration options, check out the Digma instrumentation page.
New to observability? OpenTelemetry has extensive documentation explaining how to get started. [ Get started with OpenTelemetry ]
Connecting your code to Digma
Python / Django
Install the Digma and OTEL Django instrumentation packages packages (if you haven’t already)
pip install opentelemetry-instrumentation-digma-django
pip install opentelemetry-instrumentation-django
Or add it to your requirements file.
Add the following lines to instrument your Django application in your setup code:
from opentelemetry.instrumentation.digma.django import DigmaIntrumentor
from opentelemetry.instrumentation.django import DjangoInstrumentor
DjangoInstrumentor().instrument()
DigmaIntrumentor.instrument()
You’re good to go! Check out our sample Django project for reference.
Python / FastAPI
Install the Digma and OTEL FastAPI instrumentation packagesPyPI packages (if you haven’t already)
pip install opentelemetry-instrumentation-digma-fastapi
pip install opentelemetry-instrumentation-fastapi
Or add them to your requirements file.
Add the following lines to Instrument your FastAPI application in your setup code:
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from opentelemetry.instrumentation.digma.fastapi import DigmaFastAPIInstrumentor
DigmaFastAPIInstrumentor().instrument_app(app)
FastAPIInstrumentor().instrument_app(app)
You’re good to go! Check out our sample FastAPI project for reference.