Debug School

viswanath reddy
viswanath reddy

Posted on

How to enable the APM for the Apache Tomcat Application and Visualize the Metrics in Datadog dashboard

Create a AWS Ec2 Instance

Login to to the AWS and check for the Ec2 service and launch the t2.medium instance.

Install the Datadog Agent

In the Datadog Dashboard --> Integrations --> Agent--> Select the Ubuntu and Use our easy one-step install.
DD_API_KEY= DD_SITE="" bash -c "$(curl -L"

Install Java 11

$ sudo apt-get update
$ sudo apt-get install openjdk-11-jdk -y
$ apt install openjdk-11-jdk-headless -y

4 Install Apache Tomcat

$ sudo apt-get install wget unzip -y --> Unzip packge
$ sudo su -
$ cd /opt/
$ wget
$ unzip
$ cd apache-tomcat-9.0.73/bin
$ chmod -R 755 .
$ ls -ltr

Install the APM Agent

Go to Datadog dash board click on APM --> Setup &Configuration --> Service Setup --> Select Host-based --> Choose Your Language--> Java

$ cd /opt
$ mkdir datadog --> create directory to install the APM agent
$ cd datadog
$ wget -O dd-java-agent.jar ''

Instrument your Application

Add the service name and environment in the details and enable required options for the application testing. Then Parameter's should be as below. After that code snippet as below.

java -javaagent:/opt/datadog/dd-java-agent.jar -Ddd.profiling.enabled=true -Ddd.logs.injection=true -Ddd.trace.sample.rate=1 -Ddd.appsec.enabled=true -Ddd.service=devops_school -Ddd.env=test -Ddd.version=1.0"

$ cd /opt/apache-tomcat-9.0.73/bin
$ vi
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/datadog/dd-java-agent.jar -Ddd.profiling.enabled=true -Ddd.logs.injection=true -Ddd.trace.sample.rate=1 -Ddd.appsec.enabled=true -Ddd.service=devops_school -Ddd.env=test -Ddd.version=1.0"

-Ddd.version=1.0 --> Ex: Added the Release version

$ systemctl restart datadog-agent
$ ./
$ ./
$ ps -eaf | grep tomcat | grep dd

Create a Traffic and Run the Traffic

For this we need to install the JMeter to run the traffic.

Visualize the Metrics in Datadog Dashboard

click on APM --> Services --> Click on service name and see the details i.e Error Tracking, Incidents, Latency, Traces

Under deployment --> Requests --> how many No. of requests are hitting in a period of time.
Under deployment --> p95Latency
Under deployment --> Errors

Top comments (0)