Skip to main content

Digma instrumentation for Python

Project description

opentelemetry-instrumenation-digma

Tests

This package provides instrumentation helpers and tools to make it easy to set up Digma to work along with your OpenTelemetry instrumentation.

In order to be able to effectively glean code-object based insights for continuous feedback and map them back in the IDE, Digma inserts additional attribute into the OTEL resource attributes.

To make it easy to use Digma, we've created this helper package.

Installing the package

pip install opentelemetry-instrumentation-digma

Building the package from source

python -m build

Instrumenting an existing project

If you are introducing both OTEL and Digma

To make it convenient to get started quickly with some default for both OpenTelemetry and Digma, a quick bootsrap function is provided. This is not intended for usage if you already have OpenTelmetry set up in your project, nor be used as a production configuration.

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 are already using OpenTelemtry tracing in your project

If you have an existing OpenTelemtry instrumentaiton set up, simply use the DigmaConfiguration object to create a Resource object and merge it with your resource to import all of the needed attributes.

resource = Resource.create(attributes={SERVICE_NAME: service_name})
resource = resource.merge(DigmaConfiguration().trace_this_package())

The Digma configuration options

Setting Description Default
set_environment Set the identifier of the deployment environment for the current trace process. e.g. 'staging', 'ci' Will try to read from env variable, otherwies 'UNSET'
set_commit_id Allows setting the commit identifier for the currently executing code. Will try to read from env variable otherwise empty
use_env_variable_for_commit_id Set a custom environment variable to read the commit identifier from in runtime. 'GIT_COMMIT_ID'
use_env_variable_for_deployment_environment Set a custom environment variable to read the deployment environment identifier from in runtime. 'DEPLOYMENT_ENV'
trace_this_package Specify the current package root folder. Used to aligned tracing with code None
trace_package Specify additional satellite or infra packages to track None

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

opentelemetry-instrumentation-digma-0.5.8.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file opentelemetry-instrumentation-digma-0.5.8.tar.gz.

File metadata

File hashes

Hashes for opentelemetry-instrumentation-digma-0.5.8.tar.gz
Algorithm Hash digest
SHA256 9e2fd2e63f09fe7faa3bf7b18de1d54739ab53613227fb4981d092d560398b39
MD5 050ef290dae75aaffb30cc6306d0336c
BLAKE2b-256 e8676e8cf7abb01a512518de9c082afa13b1c1b0b2c378c25052f19c9476fdde

See more details on using hashes here.

File details

Details for the file opentelemetry_instrumentation_digma-0.5.8-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_instrumentation_digma-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a46b37059aeec62fd87407fc4aa7f2c2115d482ba19e5176469cf140c9aab80c
MD5 d3d682671e23be0f60c404d657baa18c
BLAKE2b-256 b00f53c7405e8dfcfe1bacd2b15941940adffefe86ff011314ce13fbcb108056

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