[ad_1]
We have successfully enabled APM tracing on a python fastapi microservice in Datadog. The service is deployed in EKS using k8s deployments. Our deployment.yml file contains all necessary env vars for Datadog APM. (see below)
Copied and pasted the example provided by datadog then instrumented the application using dd-trace-py. This works well, but as we have a few more services to instrument seemed we can stick the env vars in a ConfigMap as all services live in the same namespace.
After trying this, our services do not appear in app.datadog.
Whats the best practice to follow if we have a few services that we want to instrument, which all live in the same namespace?
apiVersion: apps/v1
kind: Deployment
metadata:
name: name-of-our-deployment
namespace: namespace-example
labels:
tags.datadoghq.com/env: ${environment}
tags.datadoghq.com/service: ${service}
tags.datadoghq.com/version: ${version}-${blue-or-green}
spec:
replicas: 3
selector:
matchLabels:
app: ${service}
template:
metadata:
labels:
app: ${service}
tags.datadoghq.com/env: ${environment}
tags.datadoghq.com/service: ${service}
tags.datadoghq.com/version: ${version}-${blue-or-green}
spec:
serviceAccountName: ...
securityContext:
runAsUser: ...
imagePullSecrets:
- name: ...
containers:
- name: nameOfContainer
image: ...
imagePullPolicy: Always
resources: ...
ports:
- name: liveness-port
containerPort: 8050
protocol: TCP
env:
- name: DD_ENV
valueFrom:
fieldRef:
fieldPath: metadata.labels['tags.datadoghq.com/env']
- name: DD_SERVICE
valueFrom:
fieldRef:
fieldPath: metadata.labels['tags.datadoghq.com/service']
- name: DD_VERSION
valueFrom:
fieldRef:
fieldPath: metadata.labels['tags.datadoghq.com/version']
- name: DATADOG_TRACE_AGENT_HOSTNAME
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: DD_AGENT_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: DD_APM_ENABLED
value: "true"
- name: DD_APM_NON_LOCAL_TRAFFIC
value: "true"
- name: DD_PROXY_NO_PROXY
value: "localhost,127.0.0.1,......"
- name: DD_KUBELET_TLS_VERIFY
value: "false"
- name: DD_PROXY_HTTPS
value: " ... "
- name: DD_LOGS_ENABLED
value: "true"
- name: DD_LOGS_INJECTION
value: "true"
- name: DD_PROFILING_ENABLED
value: "true"
- name: DD_KUBERNETES_POD_LABELS_AS_TAGS
value: '{"app": "app", "service": "service", "version": "version"}'
- name: DD_TAGS
value: app:${service} collection:collection_name owner:aiTeam
[ad_2]