I’ve packaged a ready-to-use beginner lab with working code and a simple README: [Download the starter project ZIP] - https://github.com/devopsschool-assignment-projects/datadog-starter-lab-python-app [View the README] - https://github.com/devopsschool-assignment-projects/datadog-starter-lab-python-app [View the Flask app]- https://github.com/devopsschool-assignment-projects/datadog-starter-lab-python-app
A tiny Ubuntu-hosted web app with:
/health/api/items/slow/error- one simple HTML page for RUM
Then they will connect it to:
- Datadog Agent
- Infra Monitoring
- APM
- Logs
- Synthetic Monitoring
- RUM
- Alerts
- Dashboard
- API
Datadog’s docs support this exact flow: install the Agent on Linux, enable traces, turn on log collection in datadog.yaml, add a custom log file config under conf.d, create Browser RUM with a clientToken and applicationId, add Synthetic API assertions like status code and response time, and use API/Application keys for API access. ([Datadog][1])
Run this:
sudo apt update
sudo apt install -y python3 python3-venv python3-pip curl unzipFlask’s official docs support installing Flask with pip inside a virtual environment. ([Flask Documentation][2])
Copy datadog-starter-lab.zip to the Ubuntu machine, then run:
mkdir -p ~/datadog-lab
cd ~/datadog-lab
unzip datadog-starter-lab.zip
cd datadog-starter-labpython3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtsudo mkdir -p /var/log/studentapp
sudo chown -R $USER:$USER /var/log/studentappFor a Linux host, Datadog’s tutorial shows this install pattern; replace the API key and adjust DD_SITE if your org is not on datadoghq.com. ([Datadog][3])
DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=YOUR_DATADOG_API_KEY DD_SITE="datadoghq.com" bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"Start it:
sudo service datadog-agent start
sudo datadog-agent statusDatadog’s docs say Linux Agent install is done with the generated Linux script, and their tracing tutorial shows sudo service datadog-agent start on Linux. ([Datadog][1])
Datadog says log collection is not enabled by default and you must set logs_enabled: true in datadog.yaml. ([Datadog][4])
Edit:
sudo nano /etc/datadog-agent/datadog.yamlFind this line and change it to:
logs_enabled: trueDatadog’s host log docs say to create a new folder under conf.d/, place a conf.yaml there, then restart the Agent. ([Datadog][5])
Run:
sudo mkdir -p /etc/datadog-agent/conf.d/studentapp.d
sudo nano /etc/datadog-agent/conf.d/studentapp.d/conf.yamlPaste this:
logs:
- type: file
path: /var/log/studentapp/app.log
service: studentapp
source: pythonRestart the Agent:
sudo systemctl restart datadog-agent
sudo datadog-agent statusDatadog also notes that on Linux the Agent runs as the datadog-agent user, so log file permissions matter. ([Datadog][6])
Datadog’s Python tracing docs support starting a Python app with ddtrace-run, and DD_SERVICE / DD_VERSION are valid config env vars for framework integrations like Flask. ([Datadog][7])
Run:
source venv/bin/activate
export DD_SERVICE=studentapp
export DD_ENV=lab
export DD_VERSION=1.0.0
export DD_LOGS_INJECTION=true
export DD_AGENT_HOST=127.0.0.1
ddtrace-run python3 app.pyOn the Ubuntu machine:
curl http://127.0.0.1:5000/healthIn a browser:
http://YOUR_UBUNTU_IP:5000/
Open another terminal and run:
for i in {1..10}; do curl -s http://127.0.0.1:5000/ > /dev/null; done
for i in {1..5}; do curl -s http://127.0.0.1:5000/api/items > /dev/null; done
for i in {1..3}; do curl -s http://127.0.0.1:5000/slow > /dev/null; done
for i in {1..2}; do curl -s http://127.0.0.1:5000/error > /dev/null; doneNow students should see:
- host metrics from the Agent
- traces for the Flask app
- logs from
/var/log/studentapp/app.log
Datadog’s APM getting-started flow is: set up tracing, run the app, generate traffic, then explore collected traces. ([Datadog][8])
Datadog’s Browser RUM docs say you first create a JS application in Datadog, which generates a clientToken and an applicationId, then add the SDK snippet to the page. ([Datadog][9])
In Datadog UI:
-
Go to Digital Experience
-
Click Add an Application
-
Choose JavaScript (JS)
-
Create the app
-
Copy:
clientTokenapplicationId
source venv/bin/activate
export DD_SERVICE=studentapp
export DD_ENV=lab
export DD_VERSION=1.0.0
export DD_LOGS_INJECTION=true
export DD_AGENT_HOST=127.0.0.1
export DD_RUM_ENABLED=true
export DD_CLIENT_TOKEN=YOUR_CLIENT_TOKEN
export DD_APPLICATION_ID=YOUR_APPLICATION_ID
export DD_SITE=datadoghq.com
ddtrace-run python3 app.pyThe supplied index.html already contains the Datadog Browser RUM snippet. After that, page loads, user interactions, and frontend performance data can appear in RUM. ([Datadog][9])
Datadog’s HTTP API test docs say API tests can assert things like status code and response time. ([Datadog][10])
Create one Synthetic API test:
-
Type: HTTP
-
URL:
http://YOUR_UBUNTU_IP:5000/health -
Assertions:
- status code =
200 - response time <
2000 ms
- status code =
Ask students to create these 2 monitors:
- CPU monitor on the Ubuntu host
- Synthetic failure monitor for
/health
Datadog’s monitor docs cover metric threshold monitors, and Synthetics results can also be used operationally for alerting. ([Datadog][11])
Ask students to create one dashboard called:
Student App Observability
Add widgets for:
- CPU
- Memory
- request count
- latency
- error count
- log stream
- Synthetic result
Datadog dashboards are intended for combining these telemetry views in one place. ([Datadog][12])
Datadog’s API docs say:
- write requests need an API key
- read requests also need an Application key
- headers are
DD-API-KEYandDD-APPLICATION-KEY([Datadog][13])
Give students this exact example:
export DD_API_KEY=YOUR_API_KEY
export DD_APP_KEY=YOUR_APPLICATION_KEY
curl -X GET "https://api.datadoghq.com/api/v1/dashboard/lists/manual" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"If they use EU instead of US1, use the Datadog EU API host instead. Datadog’s auth docs note that API hosts vary by site. ([Datadog][13])
Have each team submit:
- screenshot of Infrastructure host
- screenshot of APM traces
- screenshot of Logs Explorer
- screenshot of RUM
- screenshot of Synthetic test
- screenshot of 2 monitors
- screenshot of dashboard
- output of the curl API command
Send to an email to DevOps@rajeshkumar.xyz