Skip to content

feat: add Datadog tracer to Dockerfiles#45

Merged
scottgerring merged 6 commits into
mainfrom
feat/add-datadog-to-docker
Jun 18, 2025
Merged

feat: add Datadog tracer to Dockerfiles#45
scottgerring merged 6 commits into
mainfrom
feat/add-datadog-to-docker

Conversation

@jeastham1993

Copy link
Copy Markdown
Collaborator

Update .NET Dockerfiles to include the Datadog tracer.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-) \

Comment thread user-management/src/Stickerlandia.UserManagement.Api/Dockerfile
Comment on lines +5 to +7
# 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

Copilot AI Jun 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Fetching the latest tracer on every build impedes reproducibility. Consider accepting a build ARG for TRACER_VERSION or pinning to a known release.

Suggested change
# 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

Copilot uses AI. Check for mistakes.
Comment thread user-management/src/Stickerlandia.UserManagement.Api/Dockerfile-x86 Outdated
set -e

# Map TARGETPLATFORM to Rust target
case "$TARGETPLATFORM" in

@jeastham1993 jeastham1993 Jun 17, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled directly from your Rust example @scottgerring 🎉

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semi-related: there was an amazing article about the horror of target triples that popped up recently. Worth reading if you want to cry.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naaa, all good for crying thanks :)

@scottgerring scottgerring left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of Qs and a suggestion!

set -e

# Map TARGETPLATFORM to Rust target
case "$TARGETPLATFORM" in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: ./user-management
file: ./user-management/src/Stickerlandia.UserManagement.Api/Dockerfile
platforms: linux/amd64,linux/arm64

Comment thread user-management/src/Stickerlandia.UserManagement.Api/Dockerfile Outdated
Comment thread user-management/src/Stickerlandia.UserManagement.Api/Dockerfile
Comment thread user-management/src/Stickerlandia.UserManagement.Api/Dockerfile

@scottgerring scottgerring left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@scottgerring scottgerring merged commit 4e9c392 into main Jun 18, 2025
9 checks passed
@scottgerring scottgerring deleted the feat/add-datadog-to-docker branch June 18, 2025 10:44
jeastham1993 added a commit that referenced this pull request Jun 19, 2025
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants