Doug Balog
11/11/2021, 2:32 PMKevin Kho
11/11/2021, 2:53 PMBilly McMonagle
11/12/2021, 12:25 AMKevin Kho
11/12/2021, 12:32 AMBilly McMonagle
11/12/2021, 12:34 AMKevin Kho
11/12/2021, 2:20 AMDoug Balog
11/12/2021, 3:54 PMBilly McMonagle
11/12/2021, 8:29 PMDoug Balog
11/23/2021, 5:43 PMflow.run_config = KubernetedRun(job_template_path="custom_job_template.yaml" )
apiVersion: batch/v1
kind: Job
spec:
template:
spec:
containers:
- name: flow
volumeMounts:
- name: dsdsocket
mountPath: /var/run/datadog
readOnly: false
env:
- name: DD_DOGSTATSD_SOCKET
value: /var/run/datadog/dsd.socket
volumes:
- hostPath:
path: /var/run/datadog/
name: dsdsocket
values.yaml
. I haven’t had a chance to reduce to the min working config yet.
---
datadog:
apiKeyExistingSecret: datadog-secret
appKeyExistingSecret: datadog-secret
dogstatsd:
originDetection: true
useHostPort: true
useHostPID: true
targetSystem: linux
useSocketVolume: true
nonLocalTraffic: true
apm:
portEnabled: true
socketEnabled: true
env:
- name: DD_DOGSTATSD_SOCKET
value: /var/run/datadog/dsd.socket
clusterAgent:
enabled: true
metricsProvider:
enabled: true
agents:
volumes:
- hostPath:
path: /var/run/datadog
name: dsdsocket
volumeMounts:
- name: dsdsocket
mountPath: /var/run/datadog
readOnly: false
Anna Geller
11/23/2021, 6:25 PMDoug Balog
11/23/2021, 6:52 PMBilly McMonagle
11/23/2021, 6:55 PMDoug Balog
11/23/2021, 10:49 PM@task
def report_to_data_dog(flow_config, stats):
# This import needs to be here to avoid cloud pickle issues with prefect.
from datadog import initialize, statsd
logger = prefect.context.get("logger")
<http://logger.info|logger.info>("Reporting to DataDog")
dogstatsd_socket = os.environ.get("DD_DOGSTATSD_SOCKET")
initialize(statsd_socket_path=dogstatsd_socket)
tags = config.get_datadog_tags(prefect.context)
# Stats is a List of dicts that have various stats from previous tasks.
# for s in stats:
# for k,v in s.items():
# statsd.gauge(k,v, tags=tags)
statsd.gauge("test.gauge", randint(0,100), tags=tags)
The test.gauge
was just to have the simplest flow to prove that I could get it to work.
Also thinking about looking into the work you did with structured logging. Not sure if I should use logs or metrics. My first thought was metrics.