Single Step Instrumentation for Backend Error Tracking
Overview
Install or update a Datadog Agent with the Enable APM Instrumentation and Error Tracking Standalone options to enable standalone Backend Error Tracking.
This allows you to automatically instrument your application, without any additional installation or configuration steps.
Install standalone Backend Error Tracking
The following examples show how it works for each deployment type.
For a Linux host:
Run the one-line installation command:
DD_API_KEY=<YOUR_DD_API_KEY> DD_SITE="<YOUR_DD_SITE>" DD_APM_INSTRUMENTATION_ENABLED=host DD_APM_INSTRUMENTATION_LIBRARIES="java:1,python:2,js:5,dotnet:3,php:1" DD_APM_ERROR_TRACKING_STANDALONE=true DD_ENV=<AGENT_ENV> bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"
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
).
Restart the services on the host or VM.
You can enable Backend Error Tracking 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.
Requirements
- Kubernetes v1.20+
- Helm for deploying the Datadog Operator.
- Kubectl CLI for installing the Datadog Agent.
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.
To enable Single Step Instrumentation with the Datadog Operator:
- Install the Datadog Operator v1.14.0+ with Helm:
helm repo add datadog https://helm.datadoghq.com
helm repo update
helm install my-datadog-operator datadog/datadog-operator
- Create a Kubernetes secret to store your Datadog API key:
kubectl create secret generic datadog-secret --from-literal api-key=<YOUR_DD_API_KEY>
- Create
datadog-agent.yaml
with the spec of your Datadog Agent deployment configuration. The simplest configuration is as follows:apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: datadog
spec:
global:
site: <DATADOG_SITE>
tags:
- env:<AGENT_ENV>
credentials:
apiSecret:
secretName: datadog-secret
keyName: api-key
env:
- name: DD_CORE_AGENT_ENABLED
value: "false"
features:
apm:
enabled: true
errorTrackingStandalone:
enabled: true
instrumentation:
enabled: true
libVersions:
java: "1"
dotnet: "3"
python: "2"
js: "5"
php: "1"
Replace <DATADOG_SITE>
with your Datadog site and <AGENT_ENV>
with the environment your Agent is installed on (for example, env:staging
). - Run the following command:
kubectl apply -f /path/to/your/datadog-agent.yaml
- After waiting a few minutes for the Datadog Cluster Agent changes to apply, restart your applications.
Follow these steps to enable Single Step Instrumentation across your entire cluster with Helm. This automatically sends errors for all applications in the cluster that are written in supported languages.
To enable Single Step Instrumentation with Helm:
Add the Helm Datadog repo:
helm repo add datadog https://helm.datadoghq.com
helm repo update
Create a Kubernetes secret to store your Datadog API key:
kubectl create secret generic datadog-secret --from-literal api-key=<YOUR_DD_API_KEY>
Create datadog-values.yaml
and add the following configuration:
agents:
containers:
agent:
env:
- name: DD_CORE_AGENT_ENABLED
value: "false"
datadog:
processAgent:
enabled: false
containerCollection: false
apiKeyExistingSecret: datadog-secret
site: <DATADOG_SITE>
tags:
- env:<AGENT_ENV>
apm:
errorTrackingStandalone:
enabled: true
# Required to enable Single-Step Instrumentation
instrumentation:
enabled: true
libVersions:
java: "1"
dotnet: "3"
python: "2"
js: "5"
php: "1"
Replace <DATADOG_SITE>
with your Datadog site and <AGENT_ENV>
with the environment your Agent is installed on (for example, env:staging
).
Run the following command to deploy the agent:
helm install datadog-agent -f datadog-values.yaml datadog/datadog
After waiting a few minutes for the Datadog Cluster Agent changes to apply, restart your applications.
Further Reading
Additional helpful documentation, links, and articles: