# Datadog Serverless Compatibility Layer for Python
Datadog library for Python to enable tracing and custom metric submission from Azure Functions and Google Cloud Run Functions (1st gen).
## Installation
1. Install the Datadog Serverless Compatibility Layer.
```
pip install datadog-serverless-compat
```
2. Install the Datadog Tracing Library following the official documentation for [Tracing Python Applications](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/python).
3. Add the Datadog Serverless Compatibility Layer and the Datadog Tracer in code.
```
from datadog_serverless_compat import start
from ddtrace import tracer, patch_all
start()
patch_all()
```
## Configuration
1. Set Datadog environment variables
- `DD_API_KEY` = `<YOUR API KEY>`
- `DD_SITE` = `datadoghq.com`
- `DD_ENV` = `<ENVIRONMENT`
- `DD_SERVICE` = `<SERVICE NAME>`
- `DD_VERSION` = `<VERSION>`
The default Datadog site is **datadoghq.com**. To use a different site, set the `DD_SITE` environment variable to the desired destination site. See [Getting Started with Datadog Sites](https://docs.datadoghq.com/getting_started/site/) for the available site values.
The `DD_SERVICE`, `DD_ENV`, and `DD_VERSION` settings are configured from environment variables in Azure and are used to tie telemetry together in Datadog as tags. Read more about [Datadog Unified Service Tagging](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging).
[Trace Metrics](https://docs.datadoghq.com/tracing/metrics/metrics_namespace/) are enabled by default but can be disabled with the `DD_TRACE_STATS_COMPUTATION_ENABLED` environment variable.
Enable debug logs for the Datadog Serverless Compatibility Layer with the `DD_LOG_LEVEL` environment variable:
```
DD_LOG_LEVEL=debug
```
Alternatively disable logs for the Datadog Serverless Compatibility Layer with the `DD_LOG_LEVEL` environment variable:
```
DD_LOG_LEVEL=off
```
1. For additional tracing configuration options, see the [official documentation for Datadog trace client](https://ddtrace.readthedocs.io/en/stable/configuration.html).
2. If installing to Azure Functions, install the [Datadog Azure Integration](https://docs.datadoghq.com/integrations/azure/#setup) and set tags on your Azure Functions to further extend unified service tagging. This allows for Azure Function metrics and other Azure metrics to be correlated with traces.
Raw data
{
"_id": null,
"home_page": "https://github.com/DataDog/datadog-serverless-compat-py",
"name": "datadog-serverless-compat",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "datadog, azure, google, functions",
"author": "Datadog, Inc.",
"author_email": "dev@datadoghq.com",
"download_url": "https://files.pythonhosted.org/packages/93/65/9e9d9e82f9994858b36183d3d7d5729b259edd19929fc3759a01dfaeb32a/datadog_serverless_compat-0.1.0.tar.gz",
"platform": null,
"description": "# Datadog Serverless Compatibility Layer for Python\n\nDatadog library for Python to enable tracing and custom metric submission from Azure Functions and Google Cloud Run Functions (1st gen).\n\n## Installation\n\n1. Install the Datadog Serverless Compatibility Layer.\n```\npip install datadog-serverless-compat\n```\n\n2. Install the Datadog Tracing Library following the official documentation for [Tracing Python Applications](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/python).\n\n3. Add the Datadog Serverless Compatibility Layer and the Datadog Tracer in code.\n\n```\nfrom datadog_serverless_compat import start\nfrom ddtrace import tracer, patch_all\n\nstart()\npatch_all()\n```\n\n## Configuration\n\n1. Set Datadog environment variables\n - `DD_API_KEY` = `<YOUR API KEY>`\n - `DD_SITE` = `datadoghq.com`\n - `DD_ENV` = `<ENVIRONMENT`\n - `DD_SERVICE` = `<SERVICE NAME>`\n - `DD_VERSION` = `<VERSION>`\n\nThe default Datadog site is **datadoghq.com**. To use a different site, set the `DD_SITE` environment variable to the desired destination site. See [Getting Started with Datadog Sites](https://docs.datadoghq.com/getting_started/site/) for the available site values.\n\nThe `DD_SERVICE`, `DD_ENV`, and `DD_VERSION` settings are configured from environment variables in Azure and are used to tie telemetry together in Datadog as tags. Read more about [Datadog Unified Service Tagging](https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging).\n\n[Trace Metrics](https://docs.datadoghq.com/tracing/metrics/metrics_namespace/) are enabled by default but can be disabled with the `DD_TRACE_STATS_COMPUTATION_ENABLED` environment variable.\n\nEnable debug logs for the Datadog Serverless Compatibility Layer with the `DD_LOG_LEVEL` environment variable:\n\n```\nDD_LOG_LEVEL=debug\n```\n\nAlternatively disable logs for the Datadog Serverless Compatibility Layer with the `DD_LOG_LEVEL` environment variable:\n\n```\nDD_LOG_LEVEL=off\n```\n\n1. For additional tracing configuration options, see the [official documentation for Datadog trace client](https://ddtrace.readthedocs.io/en/stable/configuration.html).\n\n2. If installing to Azure Functions, install the [Datadog Azure Integration](https://docs.datadoghq.com/integrations/azure/#setup) and set tags on your Azure Functions to further extend unified service tagging. This allows for Azure Function metrics and other Azure metrics to be correlated with traces.\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Datadog Serverless Compatibility Layer for Python",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/DataDog/datadog-serverless-compat-py",
"Repository": "https://github.com/DataDog/datadog-serverless-compat-py"
},
"split_keywords": [
"datadog",
" azure",
" google",
" functions"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "db5a5ad1094a010b060aa0c30b36daf5eabafbf4b7c60bc0f2d839494858652f",
"md5": "18db41fff43193b518d8a24df9235b2a",
"sha256": "8f7a68b2ffc09baa8f6492ada0c071b87a416d068ba8b14fe6496fc33bd11729"
},
"downloads": -1,
"filename": "datadog_serverless_compat-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18db41fff43193b518d8a24df9235b2a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4538542,
"upload_time": "2025-01-15T15:56:06",
"upload_time_iso_8601": "2025-01-15T15:56:06.246122Z",
"url": "https://files.pythonhosted.org/packages/db/5a/5ad1094a010b060aa0c30b36daf5eabafbf4b7c60bc0f2d839494858652f/datadog_serverless_compat-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "93659e9d9e82f9994858b36183d3d7d5729b259edd19929fc3759a01dfaeb32a",
"md5": "5568c8a45292cb78190a6154c310e2ff",
"sha256": "1a8fce6dfe698d82c330c9add62274d6052d16114cca3d3f38085736c1341c85"
},
"downloads": -1,
"filename": "datadog_serverless_compat-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5568c8a45292cb78190a6154c310e2ff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 4539223,
"upload_time": "2025-01-15T15:56:08",
"upload_time_iso_8601": "2025-01-15T15:56:08.792240Z",
"url": "https://files.pythonhosted.org/packages/93/65/9e9d9e82f9994858b36183d3d7d5729b259edd19929fc3759a01dfaeb32a/datadog_serverless_compat-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-15 15:56:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DataDog",
"github_project": "datadog-serverless-compat-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "datadog-serverless-compat"
}