Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Single Step Instrumentation (SSI) for APM installs the Datadog Agent and instruments your applications in one step, with no additional configuration steps required.
If you install or update a Datadog Agent with the Enable APM Instrumentation option selected, the Agent is installed and configured to enable APM. This automatically instruments your application, without any additional installation or configuration steps.
The following examples show how it works for each deployment type.
Replace <YOUR_DD_API_KEY> with your Datadog API key, <YOUR_DD_SITE> with your Datadog site, and <AGENT_ENV> with the environment your Agent is installed on (for example, staging).
You can enable APM by installing the Agent with either:
Datadog Operator
Datadog Helm chart
Single Step Instrumentation doesn't instrument applications in the namespace where you install the Datadog Agent. It's recommended to install the Agent in a separate namespace in your cluster where you don't run your applications.
Follow these steps to enable Single Step Instrumentation across your entire cluster with the Datadog Operator. This automatically sends traces for all applications in the cluster that are written in supported languages.
Note: To configure Single Step Instrumentation for specific namespace or pods, see Advanced options.
To enable Single Step Instrumentation with the Datadog Operator:
After waiting a few minutes for the Datadog Cluster Agent changes to apply, restart your applications.
Installing with Helm
Follow these steps to enable Single Step Instrumentation across your entire cluster with Helm. This automatically sends traces for all applications in the cluster that are written in supported languages.
Note: To configure Single Step Instrumentation for specific namespace or pods, see Advanced options.
By default, Java, Python, Ruby, Node.js, PHP and .NET Core Datadog APM libraries are installed when DD_APM_INSTRUMENTATION_ENABLED is set. DD_APM_INSTRUMENTATION_LIBRARIES is used to override which libraries are installed. The value is a comma-separated string of colon-separated library name and version pairs.
Example values for DD_APM_INSTRUMENTATION_LIBRARIES:
DD_APM_INSTRUMENTATION_LIBRARIES="java:1" - install only the Java Datadog APM library pinned to the major version 1 release line.
DD_APM_INSTRUMENTATION_LIBRARIES="java:1,python:2" - install only the Java and Python Datadog APM libraries pinned to the major versions 1 and 2 respectively.
DD_APM_INSTRUMENTATION_LIBRARIES="java:1.38.0,python:2.10.5" - install only the Java and Python Datadog APM libraries pinned to the specific versions 1.38.0 and 2.10.5 respectively.
Available versions are listed in source repositories for each language:
By default, Java, Python, Ruby, Node.js and .NET Core Datadog APM libraries are installed when DD_APM_INSTRUMENTATION_ENABLED is set. DD_APM_INSTRUMENTATION_LIBRARIES is used to override which libraries are installed. The value is a comma-separated string of colon-separated library name and version pairs.
Example values for DD_APM_INSTRUMENTATION_LIBRARIES:
DD_APM_INSTRUMENTATION_LIBRARIES="java:1" - install only the Java Datadog APM library pinned to the major version 1 release line.
DD_APM_INSTRUMENTATION_LIBRARIES="java:1,python:2" - install only the Java and Python Datadog APM libraries pinned to the major versions 1 and 2 respectively.
DD_APM_INSTRUMENTATION_LIBRARIES="java:1.38.0,python:2.10.5" - install only the Java and Python Datadog APM libraries pinned to the specific versions 1.38.0 and 2.10.5 respectively.
Available versions are listed in source repositories for each language:
By default, Single Step Instrumentation instruments all services in all namespaces in your cluster. Alternatively, you can create targeting blocks with the targets label to specify which workloads to instrument and what configurations to apply.
Each target block has the following keys:
Key
Description
name
The name of the target block. This has no effect on monitoring state and is used only as metadata.
namespaceSelector
The namespace(s) to instrument. Specify using one or more of: - matchNames: A list of one or more namespace name(s). - matchLabels: A list of one or more label(s) defined in {key,value} pairs. - matchExpressions: A list of namespace selector requirements.
The pod(s) to instrument. Specify using one or more of: - matchLabels: A list of one or more label(s) defined in {key,value} pairs. - matchExpressions: A list of pod selector requirements.
APM SDK configs that allow setting Unified Service Tags, enabling Datadog products beyond tracing, and customizing other APM settings. See full list of options.
The file you need to configure depends on how you enabled Single Step Instrumentation:
If you enabled SSI with Datadog Operator, edit datadog-agent.yaml.
If you enabled SSI with Helm, edit datadog-values.yaml.
Example 2: Instrument a subset of namespaces, matching on names and labels
This configuration creates two targets blocks:
The first block (named login-service_namespace):
enables APM for services in the namespace login-service.
instructs Datadog to instrument services in this namespace with the default version of the Java APM SDK.
sets environment variables – DD_SERVICE, DD_ENV, and DD_PROFILING_ENABLED – for this target group.
The second block (named billing-service_apps)
enables APM for services in the namespace(s) with label app:billing-service.
instructs Datadog to instrument this set of services with v3.1.0 of the Python APM SDK.
sets environment variables – DD_SERVICE and DD_ENV – for this target group.
apm:instrumentation:enabled:truetargets:- name:"login-service_namespace"namespaceSelector:matchNames:- "login-service"ddTraceVersions:java:"default"ddTraceConfigs:- name:"DD_SERVICE"value:"login-service"- name:"DD_ENV"value:"prod"- name:"DD_PROFILING_ENABLED"## profiling is enabled for all services in this namespacevalue:"auto"- name:"billing-service_apps"namespaceSelector:matchLabels:app:"billing-service"ddTraceVersions:python:"3.1.0"ddTraceConfigs:- name:"DD_SERVICE"value:"billing-service"- name:"DD_ENV"value:"prod
Example 3: Instrument different workloads with different tracers
This configuration does the following:
enables APM for pods with the following labels:
app:db-user, which marks pods running the db-user application.
webserver:routing, which marks pods running the request-router application.
instructs Datadog to use the default versions of the Datadog Tracer SDKs.
sets several Datadog environment variables to apply to each target group.
apm:instrumentation:enabled:truetargets:- name:"db-user"podSelector:matchLabels:app:"db-user"ddTraceVersions:java:"default"ddTraceConfigs:## trace configs set for services in matching pods- name:"DD_SERVICE"value:"db-user"- name:"DD_ENV"value:"prod"- name:"DD_DSM_ENABLED"value:"true"- name:"user-request-router"podSelector:matchLabels:webserver:"user"ddTraceVersions:php:"default"ddTraceConfigs:- name:"DD_SERVICE"value:"user-request-router"- name:"DD_ENV"value:"prod
Example 4: Instrument a pod within a namespace
This configuration:
enables APM for pods labeled app:password-resolver inside the login-service namespace.
instructs Datadog to use the default version of the Datadog Java Tracer SDK.
sets several Datadog environment variables to apply to this target.
You can choose to enable or disable instrumentation for applications in specific namespaces. You can only set enabledNamespaces or disabledNamespaces, not both.
The file you need to configure depends on if you enabled Single Step Instrumentation with Datadog Operator or Helm:
Datadog Operator
To enable instrumentation for specific namespaces, add enabledNamespaces configuration to datadog-agent.yaml:
features:apm:instrumentation:enabled:trueenabledNamespaces:# Add namespaces to instrument- default- applications
To disable instrumentation for specific namespaces, add disabledNamespaces configuration to datadog-agent.yaml:
features:apm:instrumentation:enabled:truedisabledNamespaces:# Add namespaces to not instrument- default- applications
Helm
To enable instrumentation for specific namespaces, add enabledNamespaces configuration to datadog-values.yaml:
datadog:apm:instrumentation:enabled:trueenabledNamespaces:# Add namespaces to instrument- namespace_1- namespace_2
To disable instrumentation for specific namespaces, add disabledNamespaces configuration to datadog-values.yaml:
datadog:apm:instrumentation:enabled:truedisabledNamespaces:# Add namespaces to not instrument- namespace_1- namespace_2
Starting with Datadog Cluster Agent v7.52.0+, you can automatically instrument a subset of your applications, based on the tracing libraries you specify.
Specify Datadog tracing libraries and their versions to automatically instrument applications written in those languages. You can configure this in two ways, which are applied in the following order of precedence:
Default: If you don’t specify any library versions and apm.instrumentation.enabled=true, applications written in supported languages are automatically instrumented using the latest tracing library versions.
To automatically instrument applications in specific pods, add the appropriate language annotation and library version for your application in your pod spec:
Replace <CONTAINER IMAGE TAG> with the desired library version. Available versions are listed in the Datadog container registries and tracer source repositories for each language:
If you don’t enable automatic instrumentation for specific pods using annotations, you can specify which languages to instrument across the entire cluster using the Single Step Instrumentation configuration. When apm.instrumentation.libVersions is set, only applications written in the specified languages will be instrumented, using the specified library versions.
The file you need to configure depends on if you enabled Single Step Instrumentation with Datadog Operator or Helm:
Datadog Operator
For example, to instrument .NET, Python, and Node.js applications, add the following configuration to your datadog-agent.yaml file:
features:apm:instrumentation:enabled:truelibVersions:# Add any libraries and versions you want to setdotnet:"3.2.0"python:"1.20.6"js:"4.17.0"
Helm
For example, to instrument .NET, Python, and Node.js applications, add the following configuration to your datadog-values.yaml file:
datadog:apm:instrumentation:enabled:truelibVersions:# Add any libraries and versions you want to setdotnet:"3.2.0"python:"1.20.6"js:"4.17.0"
The DD_ADMISSION_CONTROLLER_AUTO_INSTRUMENTATION_CONTAINER_REGISTRY environment variable in the Datadog Cluster Agent configuration specifies the registry used by the Admission Controller. The default value is gcr.io/datadoghq.
You can pull the tracing library from a different registry by changing it to docker.io/datadog, public.ecr.aws/datadog, or another URL if you are hosting the images in a local container registry.
As an alternative, or for a version of the agent that does not support workload selection, you can also disable pod mutation by adding a label to your pod.
In addition to disabling SSI, the following steps disable other mutating webhooks. Use with caution.
Set the admission.datadoghq.com/enabled: label to "false" for the pod spec: