feat: add Datadog tracer to Dockerfiles#45
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds Datadog’s .NET tracer to both the x86 and ARM64 Docker images and configures the .NET runtime for profiling.
- Download and install the latest Datadog tracer .deb in the build and runtime stages
- Copy tracer package from build to runtime and install via
dpkg - Export environment variables to enable and configure the .NET profiler
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Dockerfile-x86 | Download tracer .deb for amd64, install it, and set profiling ENVs |
| Dockerfile | Download tracer .deb for arm64, install it, and set profiling ENVs |
Comments suppressed due to low confidence (2)
user-management/src/Stickerlandia.UserManagement.Api/Dockerfile-x86:6
- The backslash before the HTTPS URL breaks the curl command. It should be removed or placed at end-of-line to properly escape a newline.
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
user-management/src/Stickerlandia.UserManagement.Api/Dockerfile:6
- The backslash before the URL likely prevents curl from recognizing the address. Remove it or correctly escape the newline.
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
| # Download the latest version of the tracer but don't install yet | ||
| RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \ | ||
| && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb |
There was a problem hiding this comment.
[nitpick] Fetching the latest tracer on every build impedes reproducibility. Consider accepting a build ARG for TRACER_VERSION or pinning to a known release.
| # Download the latest version of the tracer but don't install yet | |
| RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \ | |
| && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb | |
| # Download the specified version of the tracer but don't install yet | |
| ARG TRACER_VERSION=2.30.0 | |
| RUN curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb |
| set -e | ||
|
|
||
| # Map TARGETPLATFORM to Rust target | ||
| case "$TARGETPLATFORM" in |
There was a problem hiding this comment.
Pulled directly from your Rust example @scottgerring 🎉
There was a problem hiding this comment.
Semi-related: there was an amazing article about the horror of target triples that popped up recently. Worth reading if you want to cry.
There was a problem hiding this comment.
Naaa, all good for crying thanks :)
scottgerring
left a comment
There was a problem hiding this comment.
Couple of Qs and a suggestion!
| set -e | ||
|
|
||
| # Map TARGETPLATFORM to Rust target | ||
| case "$TARGETPLATFORM" in |
There was a problem hiding this comment.
Semi-related: there was an amazing article about the horror of target triples that popped up recently. Worth reading if you want to cry.
| @@ -2,6 +2,10 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | |||
|
|
|||
There was a problem hiding this comment.
Do we need Dockerfile-x86 ? You should just be able to build the regular Dockerfile with --target and have everything work. This is already happening in the container build:
stickerlandia/.github/workflows/user-management.yml
Lines 152 to 158 in b458dd2
* feat: correct sticker-award to handle errors according to API spec * feat: add AWS implementation and IaC * Update user-management/infra/aws/lib/network.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: update connection string * chore: add labels to docker image * chore: remove ASPNET Lambda hosting * chore: add todos for future shared infra * feat: enable static analysis (#44) * feat: implement fixes from static analysis * feat: add static analysis configuration * feat: add static analysis configuration * fix: remove duplicate .sln file * Update user-management/src/Stickerlandia.UserManagement.Api/Configurations/RemoveSwaggerDefinitionsFilter.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Merge pull request #45 from DataDog/feat/add-datadog-to-docker feat: add Datadog tracer to Dockerfiles * feat(user-management): update docs (#37) * chore: update OpenAPI docs * chore: update README * chore: add license and notice files * chore: add dockerignore file * Update user-management/src/Stickerlandia.UserManagement.Api/Configurations/RemoveSwaggerDefinitionsFilter.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update user-management/src/Stickerlandia.UserManagement.Api/Configurations/AuthorizeOperationFilter.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update user-management/README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: expand local dev and code structure docs * chore: add cloud provider specific SLN files * fix: specify .sln in dotnet restore * chore: docs updates --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: add AWS implementation and IaC * feat: update connection string * Update user-management/infra/aws/lib/network.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: add labels to docker image * chore: remove ASPNET Lambda hosting * chore: add todos for future shared infra * chore: fix static analysis for AWS impls * feat: add arch diagram and README for AWS infra --------- Co-authored-by: Scott Gerring <scott@scottgerring.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Scott Gerring <scottgerring@users.noreply.github.com>
Update .NET Dockerfiles to include the Datadog tracer.