Closed jennb33 closed 2 months ago
8/19 update: @Kshitiz-devops checked in with DataDog regarding the GitHub app that is still liked to the VA org. However, in Datadog it used to list the Vets API but now it's not.
8/21 update: there are some issues with DataDog, they are working on fixing this issue on the DataDog side.
8/26 update: @Kshitiz-devops has reached out to DataDog (Fri) and will set up meeting with DD tech.
This ticket is a duplicate of 82531, for Sprint 8, so that the work can be finished.
Description
Following up on the work done in the Discovery ticket 79623, this ticket is the implementation work for source code integration using DataDog, in anticipation of the deprecation of Sentry and to further build out DataDog functionality. This feature will enhance error investigation by offering direct links to the relevant sections of the Vets API repository within the error logs. See setup configuration. Integrating source code with Datadog's APM is a valuable step to consider for improved error analysis and debugging.
Tasks
Detailed Steps for Ruby implementation:
[x] Step 1: Update the Dockerfile
We'll start by adding build arguments to our Dockerfile. These will capture the Git repository URL and the current commit SHA. Add the following lines to your Dockerfile: dockerfile
Define build-time arguments for Git repository URL and commit SHA
ARG DD_GIT_REPOSITORY_URL
ARG DD_GIT_COMMIT_SHA
Set an environment variable that Datadog can use to tag telemetry
ENV DD_TAGS="git.repository_url:${DD_GIT_REPOSITORY_URL},git.commit.sha:${DD_GIT_COMMIT_SHA}"
These instructions set up build-time arguments which are then converted into an environment variable, DD_TAGS. This environment variable will store our version control information in a format that Datadog can use to tag telemetry data.
[x] Step 2: Building the Docker Image Next, we'll build our Docker image and pass in the necessary version control information as arguments. This is crucial for ensuring each image build can be accurately traced back to its codebase state. Use the following command in your terminal or CI/CD pipeline: bash docker build . \ -t my-application \ --build-arg DD_GIT_REPOSITORY_URL=<git-provider.example/me/my-repo> \ --build-arg DD_GIT_COMMIT_SHA=$(git rev-parse HEAD) Replace <git-provider.example/me/my-repo> with the actual URL of your Git repository. The $(git rev-parse HEAD) command fetches the latest commit SHA from your repository, ensuring your build is tagged with the most recent codebase state.
[x] Step 3: Deploy and Run With the build complete, you can run your Docker container as usual. The environment variable containing the Git details is now embedded within the container.
[x] Step 4: Validation in Datadog Once application is deployed, log into Datadog to confirm that the telemetry data is being tagged correctly. We should see git.repository_url and git.commit.sha tags accompanying metrics, logs, and traces, which help in tracing issues back to their source changes.
Acceptability Criteria
Definition of Done