This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
Azure Container Apps is a fully managed serverless platform for deploying and scaling container-based applications. Datadog provides monitoring and log collection for Container Apps through the Azure integration. Datadog also provides a solution for instrumenting your Container Apps applications with a purpose-built Agent to enable tracing, custom metrics, and direct log collection.
The serverless-init application wraps your process and executes it as a subprocess. It starts a DogStatsD listener for metrics and a Trace Agent listener for traces. It collects logs by wrapping the stdout/stderr streams of your application. After bootstrapping, serverless-init then launches your command as a subprocess.
To get full instrumentation, ensure you are calling datadog-init as the first command that runs inside your Docker container. You can do this through by setting it as the entrypoint, or by setting it as the first argument in CMD.
Change the entrypoint to wrap your application in the Datadog serverless-init process.
Note: If you already have an entrypoint defined inside your Dockerfile, see the alternative configuration.
ENTRYPOINT["/app/datadog-init"]
Execute your binary application wrapped in the entrypoint. Adapt this line to your needs.
If you require your entrypoint to be instrumented as well, you can swap your entrypoint and CMD arguments instead. For more information, see How serverless-init works.
Change the entrypoint to wrap your application in the Datadog serverless-init process.
Note: If you already have an entrypoint defined inside your Dockerfile, see the alternative configuration.
ENTRYPOINT["/app/datadog-init"]
Execute your binary application wrapped in the entrypoint, launched by the Datadog trace library. Adapt this line to your needs.
If you require your entrypoint to be instrumented as well, you can swap your entrypoint and CMD arguments instead. For more information, see How serverless-init works.
Change the entrypoint to wrap your application in the Datadog serverless-init process.
Note: If you already have an entrypoint defined inside your Dockerfile, see the alternative configuration.
ENTRYPOINT["/app/datadog-init"]
Execute your binary application wrapped in the entrypoint. Adapt this line to your needs.
If you require your entrypoint to be instrumented as well, you can swap your entrypoint and CMD arguments instead. For more information, see How serverless-init works.
Change the entrypoint to wrap your application in the Datadog serverless-init process.
Note: If you already have an entrypoint defined inside your Dockerfile, see the alternative configuration.
If you require your entrypoint to be instrumented as well, you can swap your entrypoint and CMD arguments instead. For more information, see How serverless-init works.
As long as your command to run is passed as an argument to datadog-init, you will receive full instrumentation.
Note: You can also use Orchestrion, a tool for automatically instrumenting Go code. Orchestrion is in private beta. For more information, open a GitHub issue in the Orchestrion repo, or contact Support.
Add the following instructions and arguments to your Dockerfile.
# For alpine or arm64 builds, refer to the explanation sectionCOPY --from=datadog/serverless-init:1 / /app/RUN chmod +x /app/dotnet.sh && /app/dotnet.shENVDD_SERVICE=datadog-demo-run-dotnetENVDD_ENV=datadog-demoENVDD_VERSION=1ENTRYPOINT["/app/datadog-init"]CMD["dotnet","helloworld.dll"]
Copy the Datadog serverless-init into your Docker image.
COPY --from=datadog/serverless-init:1 / /app/
Copy the Datadog .NET tracer into your Docker image.
For linux/amd64, include the following:
RUN chmod +x /app/dotnet.sh && /app/dotnet.sh
For other architecture types, configure your Dockerfile like so:
# For arm64 use datadog-dotnet-apm-2.57.0.arm64.tar.gz# For alpine use datadog-dotnet-apm-2.57.0-musl.tar.gzARG TRACER_VERSIONADD https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm-${TRACER_VERSION}.tar.gz /tmp/datadog-dotnet-apm.tar.gzRUN mkdir -p /dd_tracer/dotnet/ && tar -xzvf /tmp/datadog-dotnet-apm.tar.gz -C /dd_tracer/dotnet/ && rm /tmp/datadog-dotnet-apm.tar.gz
Change the entrypoint to wrap your application in the Datadog serverless-init process.
Note: If you already have an entrypoint defined inside your Dockerfile, see the alternative configuration.
ENTRYPOINT["/app/datadog-init"]
Execute your binary application wrapped in the entrypoint. Adapt this line to your needs.
If you already have an entrypoint defined inside your Dockerfile, you can instead modify the CMD argument.
# For alpine or arm64 builds, refer to tracer installation of the explanation sectionCOPY --from=datadog/serverless-init:1 / /app/RUN chmod +x /app/dotnet.sh && /app/dotnet.shENVDD_SERVICE=datadog-demo-run-dotnetENVDD_ENV=datadog-demoENVDD_VERSION=1CMD["/app/datadog-init","dotnet","helloworld.dll"]
If you require your entrypoint to be instrumented as well, you can swap your entrypoint and CMD arguments instead. For more information, see How serverless-init works.
# For alpine or arm64 builds, refer to tracer installation of the explanation sectionCOPY --from=datadog/serverless-init:1 / /app/RUN chmod +x /app/dotnet.sh && /app/dotnet.shENVDD_SERVICE=datadog-demo-run-dotnetENVDD_ENV=datadog-demoENVDD_VERSION=1ENTRYPOINT["/app/datadog-init"]CMD["your_entrypoint.sh","dotnet","helloworld.dll"]
As long as your command to run is passed as an argument to datadog-init, you will receive full instrumentation.
This environment variable is needed for trace propagation to work properly in Cloud Run. Ensure that you set this variable for all Datadog-instrumented downstream services.
ENVDD_TRACE_PROPAGATION_STYLE=datadog
Change the entrypoint to wrap your application in the Datadog serverless-init process.
Note: If you already have an entrypoint defined inside your Dockerfile, see the alternative configuration.
ENTRYPOINT ["/app/datadog-init"]
Execute your binary application wrapped in the entrypoint. Adapt this line to your needs.
If you require your entrypoint to be instrumented as well, you can swap your entrypoint and CMD arguments instead. For more information, see How serverless-init works.
As long as your command to run is passed as an argument to datadog-init, you will receive full instrumentation.
Add the following instructions and arguments to your Dockerfile.
COPY --from=datadog/serverless-init:1 /datadog-init /app/datadog-initADD https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php /datadog-setup.phpRUN php /datadog-setup.php --php-bin=allENVDD_SERVICE=datadog-demo-run-phpENVDD_ENV=datadog-demoENVDD_VERSION=1ENTRYPOINT["/app/datadog-init"]# use the following for an Apache and mod_php based imageRUN sed -i "s/Listen 80/Listen 8080/" /etc/apache2/ports.confEXPOSE 8080CMD["apache2-foreground"]# use the following for an Nginx and php-fpm based imageRUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.logEXPOSE 8080CMD php-fpm; nginx -g daemon off;
Note: The datadog-init entrypoint wraps your process and collects logs from it. To get logs working properly, ensure that your Apache, Nginx, or PHP processes are writing output to stdout.
Change the entrypoint to wrap your application in the Datadog serverless-init process.
Note: If you already have an entrypoint defined inside your Dockerfile, see the alternative configuration.
ENTRYPOINT["/app/datadog-init"]
Execute your application.
Use the following for an apache and mod_php based image:
RUN sed -i "s/Listen 80/Listen 8080/" /etc/apache2/ports.confEXPOSE 8080CMD["apache2-foreground"]
Use the following for an nginx and php-fpm based image:
If you already have an entrypoint defined inside your Dockerfile, and you are using an Apache and mod_php based image, you can instead modify the CMD argument.
If you require your entrypoint to be instrumented as well, you can swap your entrypoint and CMD arguments instead. For more information, see How serverless-init works.
COPY --from=datadog/serverless-init:1 /datadog-init /app/datadog-initADD https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php /datadog-setup.phpRUN php /datadog-setup.php --php-bin=allENVDD_SERVICE=datadog-demo-run-phpENVDD_ENV=datadog-demoENVDD_VERSION=1ENTRYPOINT["/app/datadog-init"]# use the following for an Apache and mod_php based imageRUN sed -i "s/Listen 80/Listen 8080/" /etc/apache2/ports.confEXPOSE 8080CMD["your_entrypoint.sh","apache2-foreground"]# use the following for an Nginx and php-fpm based imageRUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.logEXPOSE 8080CMD your_entrypoint.sh php-fpm; your_entrypoint.sh nginx -g daemon off;
As long as your command to run is passed as an argument to datadog-init, you will receive full instrumentation.
This command deploys the service and allows any external connection to reach it. Set DD_API_KEY as an environment variable, and set your service listening to port 80.
az containerapp up \
--name APP_NAME \
--resource-group RESOURCE_GROUP \
--ingress external \
--target-port 80\
--env-vars "DD_API_KEY=$DD_API_KEY""DD_TRACE_ENABLED=true""DD_SITE=datadoghq.com"\
--image YOUR_REGISTRY/YOUR_PROJECT
Once the deployment is completed, your metrics and traces are sent to Datadog. In Datadog, navigate to Infrastructure > Serverless to see your serverless metrics and traces.
Advanced Tracing: The Datadog Agent already provides some basic tracing for popular frameworks. Follow the advanced tracing guide for more information.
Logs: If you use the Azure integration, your logs are already being collected. Alternatively, you can set the DD_LOGS_ENABLED environment variable to true to capture application logs through the serverless instrumentation directly.
Custom Metrics: You can submit custom metrics using a DogStatsD client. For monitoring Cloud Run and other serverless applications, use distribution metrics. Distributions provide avg, sum, max, min, and count aggregations by default. On the Metric Summary page, you can enable percentile aggregations (p50, p75, p90, p95, p99) and also manage tags. To monitor a distribution for a gauge metric type, use avg for both the time and space aggregations. To monitor a distribution for a count metric type, use sum for both the time and space aggregations.
Trace Sampling: To manage the APM traced request sampling rate for serverless applications, set the DD_TRACE_SAMPLE_RATE environment variable on the function to a value between 0.000 (no tracing of Container App requests) and 1.000 (trace all Container App requests).
Metrics are calculated based on 100% of the application’s traffic, and remain accurate regardless of any sampling configuration.
This integration depends on your runtime having a full SSL implementation. If you are using a slim image for Node, you may need to add the following command to your Dockerfile to include certificates.
RUN apt-get update && apt-get install -y ca-certificates