Tracing
In your main application, add the dd-trace-js
library. See Tracing Node.js applications for instructions.
Set ENV NODE_OPTIONS="--require dd-trace/init"
. This specifies that the dd-trace/init
module is required when the Node.js process starts.
Profiling
The profiler is shipped within the dd-trace-js
library. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler. See Enabling the Node.js Profiler.
Metrics
The dd-trace-js
library also collects custom metrics. See the code examples.
Logs
The Datadog sidecar collects logs through a shared volume. To forward logs from your main container to the sidecar, configure your application to write all logs to a location such as shared-volume/logs/*.log
using the steps below. During the container step, add the environment variable DD_SERVERLESS_LOG_PATH
and a shared volume mount to both the main and sidecar container. If you decide to deploy using YAML or Terraform, the environment variables, health check, and volume mount are already added.
To set up logging in your application, see Node.js Log Collection. To set up trace log correlation, see Correlating Node.js Logs and Traces.
Tracing
In your main application, add the dd-trace-java
library. Follow the instructions in Tracing Java Applications or use the following example Dockerfile to add and start the dd-trace-java
library with automatic instrumentation:
FROM eclipse-temurin:17-jre-jammy
WORKDIR /app
COPY target/cloudrun-java-1.jar cloudrun-java-1.jar
# Add the Datadog tracer
ADD 'https://dtdg.co/latest-java-tracer' dd-java-agent.jar
EXPOSE 8080
# Start the Datadog tracer with the javaagent argument
ENTRYPOINT [ "java", "-javaagent:dd-java-agent.jar", "-jar", "cloudrun-java-1.jar" ]
Profiling
The profiler is shipped within the dd-trace-java
library. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler. See Enabling the Java Profiler.
Metrics
To collect custom metrics, install the Java DogStatsD client.
Logs
The Datadog sidecar collects logs through a shared volume. To forward logs from your main container to the sidecar, configure your application to write all logs to a location such as shared-volume/logs/*.log
using the steps below. During the container step, add the environment variable DD_SERVERLESS_LOG_PATH
and a shared volume mount to both the main and sidecar container. If you decide to deploy using YAML or Terraform, the environment variables, health check, and volume mount are already added.
To set up logging in your application, see Java Log Collection. To set up trace log correlation, see Correlating Java Logs and Traces.
Tracing
In your main application, add the dd-trace-go
library. See Tracing Go Applications for instructions.
Profiling
The profiler is shipped within the dd-trace-go
library. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler. See Enabling the Go Profiler.
Metrics
The dd-trace-go
library also collects custom metrics. See the code examples.
Logs
The Datadog sidecar collects logs through a shared volume. To forward logs from your main container to the sidecar, configure your application to write all logs to a location such as shared-volume/logs/*.log
using the steps below. During the container step, add the environment variable DD_SERVERLESS_LOG_PATH
and a shared volume mount to both the main and sidecar container. If you decide to deploy using YAML or Terraform, the environment variables, health check, and volume mount are already added.
To set up logging in your application, see Go Log Collection. To set up trace log correlation, see Correlating Go Logs and Traces.
Tracing
In your main application, add the dd-trace-dotnet
library. See Tracing .NET Applications for instructions.
Example Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy
WORKDIR /app
COPY ./bin/Release/net8.0/publish /app
ADD https://github.com/DataDog/dd-trace-dotnet/releases/download/v2.56.0/datadog-dotnet-apm_2.56.0_amd64.deb /opt/datadog/datadog-dotnet-apm_2.56.0_amd64.deb
RUN dpkg -i /opt/datadog/datadog-dotnet-apm_2.56.0_amd64.deb
RUN mkdir -p /shared-volume/logs/
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/opt/datadog/
ENV DD_TRACE_DEBUG=true
ENTRYPOINT ["dotnet", "dotnet.dll"]
Profiling
The profiler is shipped within the dd-trace-dotnet
library. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler. See Enabling the .NET Profiler.
The above Dockerfile example also has the environment variables that enable the profiler.
Metrics
The dd-trace-dotnet
library also collects custom metrics. See the code examples.
Logs
The Datadog sidecar collects logs through a shared volume. To forward logs from your main container to the sidecar, configure your application to write all logs to a location such as shared-volume/logs/*.log
using the steps below. During the container step, add the environment variable DD_SERVERLESS_LOG_PATH
and a shared volume mount to both the main and sidecar container. If you decide to deploy using YAML or Terraform, the environment variables, health check, and volume mount are already added.
To set up logging in your application, see C# Log Collection. To set up trace log correlation, see Correlating .NET Logs and Traces.
In your main application, add the dd-trace-php
library. See Tracing PHP Applications for instructions.
Metrics
The dd-trace-php
library also collects custom metrics. See the code examples.
Logs
The Datadog sidecar collects logs through a shared volume. To forward logs from your main container to the sidecar, configure your application to write all logs to a location such as shared-volume/logs/*.log
using the steps below. During the container step, add the environment variable DD_SERVERLESS_LOG_PATH
and a shared volume mount to both the main and sidecar container. If you decide to deploy using YAML or Terraform, the environment variables, health check, and volume mount are already added.
To set up logging in your application, see PHP Log Collection. To set up trace log correlation, see Correlating PHP Logs and Traces.