Skip to content

Commit 7c46878

Browse files
authored
Merge pull request #1571 from CMSgov/QPPA-10859-install-datadog
QPPA-10859: Install Datadog for initial testing
2 parents 8a963e2 + 8b0db7c commit 7c46878

6 files changed

Lines changed: 88 additions & 7 deletions

File tree

.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ STRICT_EXTENSION=
5656

5757
#Override for the default CPC+ contact email address
5858
CPC_PLUS_CONTACT_EMAIL=
59+
60+
# Basic Datadog Configuration
61+
DD_API_KEY=
62+
DD_ENV=
63+
DD_SERVICE=
64+
DD_VERSION=
65+
DD_AGENT_HOST=
66+
DD_TRACE_AGENT_PORT=

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,41 @@ cp newrelic-latest/newrelic/newrelic.jar tools/docker/docker-artifacts/newrelic/
133133
docker-compose -f ./docker-compose.test.yaml up --build
134134
```
135135

136+
### Updating the Datadog Java Agent
137+
138+
**Step 1**: Check the Current Datadog Agent Version in Datadog dashboard
139+
140+
* APM > Services or Infrastructure section
141+
142+
**Step 2**: Download the Latest Datadog Java Agent
143+
144+
```bash
145+
# Download the latest Datadog Java agent
146+
curl -Lo dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
147+
```
148+
149+
**Step 3**: Replace the Existing Files
150+
151+
```bash
152+
# Place the Datadog agent in the docker artifacts directory
153+
cp dd-java-agent.jar tools/docker/docker-artifacts/datadog/
154+
155+
# Verify the file placement
156+
ls -la tools/docker/docker-artifacts/datadog/dd-java-agent.jar
157+
```
158+
159+
**Step 4**: Restart the Application and Verify in Datadog
160+
161+
```bash
162+
# Rebuild and restart the application
163+
docker-compose -f ./docker-compose.test.yaml up --build
164+
```
165+
166+
**Step 5**: Deploy and Confirm Agent Status in Datadog Dashboard
167+
168+
* APM > Services or Infrastructure section for version
169+
* APM > Services > qpp-conversion-tool for trace data
170+
136171
### Command Line
137172

138173
For the examples below, make sure you're in the `qpp-conversion-tool` directory.

rest-api/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
<!-- For documentation only; actual coordination is done by the BOMs below -->
3535
<spring-framework.version>6.2.11</spring-framework.version>
36-
<tomcat.version>10.1.44</tomcat.version>
36+
<tomcat.version>10.1.45</tomcat.version>
3737

3838
<!-- Test stack kept explicit so CI is deterministic across JDK updates -->
3939
<junit.jupiter.version>5.10.3</junit.jupiter.version>
@@ -204,17 +204,17 @@
204204
<dependency>
205205
<groupId>org.apache.tomcat.embed</groupId>
206206
<artifactId>tomcat-embed-core</artifactId>
207-
<version>10.1.44</version>
207+
<version>10.1.45</version>
208208
</dependency>
209209
<dependency>
210210
<groupId>org.apache.tomcat.embed</groupId>
211211
<artifactId>tomcat-embed-el</artifactId>
212-
<version>10.1.44</version>
212+
<version>10.1.45</version>
213213
</dependency>
214214
<dependency>
215215
<groupId>org.apache.tomcat.embed</groupId>
216216
<artifactId>tomcat-embed-websocket</artifactId>
217-
<version>10.1.44</version>
217+
<version>10.1.45</version>
218218
</dependency>
219219

220220
<dependency>

rest-api/src/main/resources/application.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ server.port=8443
88
server.ssl.key-store-type=PKCS12
99
#logging.level.org.springframework.security=DEBUG
1010
#org.springframework.security.config.annotation.web.builders.WebSecurity.debugEnabled=true
11+
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} - %msg%n
12+
logging.level.datadog.trace=INFO
13+
logging.level.com.datadoghq=INFO
31.6 MB
Binary file not shown.
Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
#!/bin/bash
22

3-
sed -i -e "s/NEWRELIC_API_KEY/$NEWRELIC_API_KEY/g" ./newrelic/newrelic.yml
4-
sed -i -e "s/APP_ENV/$APP_ENV/g" ./newrelic/newrelic.yml
5-
exec java $JAVA_OPTS -javaagent:./newrelic/newrelic.jar -jar ./rest-api.jar
3+
# Configure New Relic
4+
if [ ! -z "$NEWRELIC_API_KEY" ]; then
5+
sed -i -e "s/NEWRELIC_API_KEY/$NEWRELIC_API_KEY/g" ./newrelic/newrelic.yml
6+
sed -i -e "s/APP_ENV/$APP_ENV/g" ./newrelic/newrelic.yml
7+
NEW_RELIC_AGENT="-javaagent:./newrelic/newrelic.jar"
8+
fi
9+
10+
# Datadog configuration with New Relic feature parity
11+
if [ ! -z "$DD_API_KEY" ]; then
12+
DATADOG_AGENT="-javaagent:./datadog/dd-java-agent.jar"
13+
# Tracing: enabled with 100% sampling and analytics
14+
# Profiling: continuous profiling and traceId log injection for correlation
15+
# HTTP monitoring: error status definitions for server/client
16+
# JMX metrics: enabled for application monitoring
17+
# Method tracing: auto-trace Spring web controllers
18+
# Security: disable principal collection, enable obfuscation
19+
# Performance: exclude query strings, set async timeout
20+
DATADOG_OPTS="-Ddd.service.name=${DD_SERVICE:-qpp-conversion-tool} \
21+
-Ddd.env=${APP_ENV:-test} \
22+
-Ddd.version=${DD_VERSION:-unknown} \
23+
-Ddd.trace.enabled=true \
24+
-Ddd.trace.sample.rate=1.0 \
25+
-Ddd.trace.analytics.enabled=true \
26+
-Ddd.profiling.enabled=true \
27+
-Ddd.logs.injection=true \
28+
-Ddd.trace.http.server.error.statuses=500-599 \
29+
-Ddd.trace.http.client.error.statuses=500-599 \
30+
-Ddd.jmxfetch.enabled=true \
31+
-Ddd.trace.methods=org.springframework.web.bind.annotation.*[*] \
32+
-Ddd.trace.servlet.principal.enabled=false \
33+
-Ddd.trace.obfuscation.enabled=true \
34+
-Ddd.trace.http.client.tag.query-string=false \
35+
-Ddd.trace.servlet.async-timeout=30000"
36+
fi
37+
38+
# Start application with both agents during transition
39+
exec java $JAVA_OPTS $NEW_RELIC_AGENT $DATADOG_AGENT $DATADOG_OPTS \
40+
-jar ./rest-api.jar

0 commit comments

Comments
 (0)