diff --git a/backend/metrics.py b/backend/metrics.py index 93dbbaa..f2c57d3 100644 --- a/backend/metrics.py +++ b/backend/metrics.py @@ -1,6 +1,7 @@ import os import time from datadog import initialize, api +from ddtrace import tracer class Metrics: send_metrics = False @@ -11,6 +12,12 @@ class Metrics: Metrics.send_metrics = True initialize() api.Event.create(title="Backend start", text="", tags=["server:backend", f"host:{os.environ['HOST']}"], alert_type="info") + if "DD_TRACE_AGENT_HOST" in os.environ and "DD_TRACE_AGENT_PORT" in os.environ: + tracer.configure( + https=False, + hostname=os.environ["DD_TRACE_AGENT_HOST"], + port=os.environ["DD_TRACE_AGENT_PORT"], + ) else: print("Datadog not configured") diff --git a/backend/requirements.txt b/backend/requirements.txt index 3963313..37936e8 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -8,4 +8,5 @@ six==1.16.0 pytest==7.1.1 requests==2.27.1 discord-webhook==0.15.0 -datadog==0.44.0 \ No newline at end of file +datadog==0.44.0 +ddtrace==0.60.1 \ No newline at end of file