Skip to content

Commit

Permalink
add option to enable profiling of python integrations
Browse files Browse the repository at this point in the history
Add new config option `integration_profiling` which enables [profiling](https://docs.datadoghq.com/profiler/enabling/python/#usage) of python integrations.

This has proven valuable several times already while troubleshooting performance issues so we're adding it as an option to have it available by default without requiring a custom build.
  • Loading branch information
djova committed Dec 23, 2022
1 parent 28ad542 commit c86b0f7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion datadog_checks_base/datadog_checks/base/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os

from ..config import is_affirmative

try:
import datadog_agent
Expand All @@ -15,6 +18,12 @@
else:
patch(requests=True)

if is_affirmative(datadog_agent.get_config('integration_profiling')):
from ddtrace.profiling import Profiler

prof = Profiler(service='datadog-agent-integrations')
prof.start()

except ImportError:
# Tracing Integrations is only available with Agent 6
# Tracing & profiling Integrations is only available with Agent 6
pass

0 comments on commit c86b0f7

Please sign in to comment.