From d0caa0a96edf5351cce306cf98cb8ed918639f1b Mon Sep 17 00:00:00 2001 From: azazelm3dj3d <56496067+azazelm3dj3d@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:36:06 -0600 Subject: [PATCH] Start of a DataDog operator This is still in the very early stages of development --- requirements.txt | 3 ++- setup.py | 1 + threatingestor/__init__.py | 2 ++ threatingestor/operators/datadog.py | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 threatingestor/operators/datadog.py diff --git a/requirements.txt b/requirements.txt index daa966b..f7b78ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ loguru statsd requests pyshorteners -twitter \ No newline at end of file +twitter +ddtrace \ No newline at end of file diff --git a/setup.py b/setup.py index 0af81bb..494d9a9 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ 'beanstalk': ['greenstalk'], 'sqs': ['boto3'], 'mysql': ['pymysql'], + 'datadog': ['ddtrace'], 'extras': ['hug', 'boto3', 'greenstalk', 'watchdog'], 'all': extra_requires, }, diff --git a/threatingestor/__init__.py b/threatingestor/__init__.py index 67a1e6c..ec4acca 100644 --- a/threatingestor/__init__.py +++ b/threatingestor/__init__.py @@ -12,6 +12,8 @@ logger.info("Notifiers is not installed.") notifiers = None +# import ddtrace.profiling.auto + import threatingestor.config import threatingestor.state import threatingestor.exceptions diff --git a/threatingestor/operators/datadog.py b/threatingestor/operators/datadog.py new file mode 100644 index 0000000..f632f9b --- /dev/null +++ b/threatingestor/operators/datadog.py @@ -0,0 +1,17 @@ +from ddtrace import tracer +from ddtrace.profiling import Profiler + +from threatingestor.operators import Operator + +class Plugin(Operator): + """ + Operator for activating DataDog APM + """ + + def __init__(self, hostname=None, port=None, https=False, artifact_types=None, filter_string=None, allowed_sources=None): + """ + DataDog operator + """ + + self.tracer = tracer.configure(hostname=hostname, port=port, https=https) + self.profile = Profiler()