# opentelemetry-instrumenation-digma
[](https://github.com/digma-ai/opentelemetry-instrumentation-digma/actions/workflows/unit-tests.yml) [](https://badge.fury.io/py/opentelemetry-instrumentation-digma)
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.
### Installing the package
```bash
pip install opentelemetry-instrumentation-digma
```
### Building the package from source
```bash
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.
```python
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.
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/digma-ai/opentelemetry-instrumentation-digma",
"name": "opentelemetry-instrumentation-digma",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Roni Dover",
"author_email": "rdover@digma.ai",
"download_url": "https://files.pythonhosted.org/packages/7c/30/1807b200adcdd9002faf18f40a2240d849580fe7cd97ecbf818817ae99da/opentelemetry-instrumentation-digma-0.5.17.tar.gz",
"platform": null,
"description": "# opentelemetry-instrumenation-digma\n[](https://github.com/digma-ai/opentelemetry-instrumentation-digma/actions/workflows/unit-tests.yml) [](https://badge.fury.io/py/opentelemetry-instrumentation-digma)\n\nThis package provides instrumentation helpers and tools to make it easy to set up Digma to work along with your OpenTelemetry instrumentation.\n\nIn 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. \n\n### Installing the package\n```bash\npip install opentelemetry-instrumentation-digma\n```\n\n### Building the package from source\n\n```bash\npython -m build\n```\n\n### Instrumenting an existing project\n\n#### If you are introducing both OTEL and Digma\n\nTo 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.\n\n```python\nfrom opentelemetry.instrumentation.digma import digma_opentelemetry_boostrap\n\ndigma_opentelemetry_boostrap(service_name='server-name', digma_backend=\"http://localhost:5050\",\n configuration=DigmaConfiguration().trace_this_package())\n```\n\n#### If you are already using OpenTelemtry tracing in your project\n\nIf 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. \n\n```python\nresource = Resource.create(attributes={SERVICE_NAME: service_name})\nresource = resource.merge(DigmaConfiguration().trace_this_package())\n```\n#### The Digma configuration options\n\n| Setting | Description | Default |\n| ---------------- |------------- | -----|\n| `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' |\n| `set_commit_id` | Allows setting the commit identifier for the currently executing code. | Will try to read from env variable otherwise empty |\n| `use_env_variable_for_commit_id` | Set a custom environment variable to read the commit identifier from in runtime. | 'GIT_COMMIT_ID' | \n| `use_env_variable_for_deployment_environment` | Set a custom environment variable to read the deployment environment identifier from in runtime. | 'DEPLOYMENT_ENV' |\n| `trace_this_package` | Specify the current package root folder. Used to aligned tracing with code | None |\n| `trace_package` | Specify additional satellite or infra packages to track | None \n",
"bugtrack_url": null,
"license": "",
"summary": "Digma instrumentation for Python",
"version": "0.5.17",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9c0a02cbb278dd6567b5c665837f6b85",
"sha256": "3b35c78542e68a82518b5857fdce2b3bbad4b7308c628c74744aa95a13dc6e96"
},
"downloads": -1,
"filename": "opentelemetry_instrumentation_digma-0.5.17-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9c0a02cbb278dd6567b5c665837f6b85",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7517,
"upload_time": "2022-05-14T05:50:39",
"upload_time_iso_8601": "2022-05-14T05:50:39.748358Z",
"url": "https://files.pythonhosted.org/packages/6b/b2/cd7d0fc01f37bab5682d7722f37e017ec998892faa7d2bf662418c30d5ca/opentelemetry_instrumentation_digma-0.5.17-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "31f4cc2cc6d283c3ad9ae681eec2be93",
"sha256": "214ffa022b27ba5fee34f3ebb73349eefc3d8978c7ec00ebb495a535791767f4"
},
"downloads": -1,
"filename": "opentelemetry-instrumentation-digma-0.5.17.tar.gz",
"has_sig": false,
"md5_digest": "31f4cc2cc6d283c3ad9ae681eec2be93",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7225,
"upload_time": "2022-05-14T05:50:41",
"upload_time_iso_8601": "2022-05-14T05:50:41.030293Z",
"url": "https://files.pythonhosted.org/packages/7c/30/1807b200adcdd9002faf18f40a2240d849580fe7cd97ecbf818817ae99da/opentelemetry-instrumentation-digma-0.5.17.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-05-14 05:50:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "digma-ai",
"github_project": "opentelemetry-instrumentation-digma",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "opentelemetry-sdk",
"specs": [
[
"==",
"1.11.1"
]
]
},
{
"name": "opentelemetry-exporter-otlp",
"specs": [
[
"==",
"1.11.1"
]
]
}
],
"lcname": "opentelemetry-instrumentation-digma"
}