This ticket is a duplicate of 90707, for Sprint 9, so that the work can be finished. It was delayed due to needing support from DataDog.
Description
Following up on the work done in the Discovery ticket 79623 (https://app.zenhub.com/workspaces/platform-product-team-633af4074573d06c3cda142a/issues/gh/department-of-veterans-affairs/va.gov-team/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
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
[ ] Telemetry data is being tagged correctly
[ ] Validate git.repository_url and git.commit.sha tags accompanying metrics, logs, and traces
Definition of Done
[ ] Telemetry data is correctly tagged
[ ] Metrics, logs, and traces are validated for git.repository_url and git.commit.sha
Waiting on reply. Jason sent an email (from VA email) and will check to see if he got a response. Update: the contact was out of office, so we're still waiting.
This ticket is a duplicate of 90707, for Sprint 9, so that the work can be finished. It was delayed due to needing support from DataDog.
Description
Following up on the work done in the Discovery ticket 79623 (https://app.zenhub.com/workspaces/platform-product-team-633af4074573d06c3cda142a/issues/gh/department-of-veterans-affairs/va.gov-team/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