Datadog come with deployment and daemonset
- cluster agent (for Kubernetes metrics) deployment
- daemonset (for traching and logs) daemonset
helm repo add datadog https://helm.datadoghq.com
helm repo update
helm install <RELEASE_NAME> -f values.yaml --set datadog.apiKey=<DATADOG_API_KEY> datadog/datadog --set targetSystem=<TARGET_SYSTEM>
This chart adds the Datadog Agent to all nodes in your cluster with a DaemonSet. It also optionally deploys the kube-state-metrics chart and uses it as an additional source of metrics about the cluster. A few minutes after installation, Datadog begins to report hosts and metrics.
Logs:
For logs and APM you need some extra config
datadog:
logs:
enabled: true
containerCollectAll: true
data-k8-logs-collection
Once everything is done, then its time to add auto-discovery
again no need to install anything for auto-discovery, until you need APM (profiling)
All you need to add
ad.datadoghq.com/CONTAINER_NAME_TO_MONITOR.check_names: |
["openmetrics"]
ad.datadoghq.com/CONTAINER_NAME_TO_MONITOR.init_configs: |
[{}]
ad.datadoghq.com/CONTAINER_NAME_TO_MONITOR.instances: |
[
{
"prometheus_url": "http://%%host%%:5000/internal/metrics",
"namespace": "my_springboot_app",
"metrics": [ "*" ]
}
]
replace 5000
with the port of the container listening. again this is required to push Prometheus/openmetrics to datadog.
If you just need logs, no need for any extra fancy stuff, just containerCollectAll: true
this is enough for logs collection.
APM
You need add JAVA agent, add this in the dockerfile
RUN wget --no-check-certificate -O /app/dd-java-agent.jar https://dtdg.co/latest-java-tracer
and then you need to update CMD
to let the agent collect tracing/apm/profiling
java -javaagent:/app/dd-java-agent.jar -Ddd.profiling.enabled=$DD_PROFILING_ENABLED -XX:FlightRecorderOptions=stackdepth=256 -Ddd.logs.injection=$DD_LOGS_INJECTION -Ddd.trace.sample.rate=$DD_TRACE_SAMPLE_RATE -Ddd.service=$DD_SERVICE -Ddd.env=$DD_ENV -J-server -Dhttp.port=5000 -jar sfdc-core.jar
trace_collection_java