|
| 1 | +# DD Example |
| 2 | +This serves as an example project to run to generate metrics, traces, and logs within Datadog. |
| 3 | + |
| 4 | +# Setup / Prerequisites |
| 5 | +- [docker](https://docs.docker.com/install/) |
| 6 | +- [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/) |
| 7 | +- Start Minikube |
| 8 | + - From this directory run: |
| 9 | + ``` |
| 10 | + minikube start |
| 11 | + eval $(minikube docker-env) |
| 12 | + ``` |
| 13 | + - This will start minikube and also set the docker environment to the one minikube offers instead of the one that you may already have installed in your local environment. |
| 14 | + |
| 15 | +# Run the example app |
| 16 | +## Build Docker Image |
| 17 | +``` |
| 18 | +docker build -t sample_flask:latest ./raw_files/flask/ |
| 19 | +docker build -t sample_postgres:latest ./raw_files/postgres/ |
| 20 | +``` |
| 21 | + |
| 22 | +## Put API Key secret in minikube |
| 23 | +Replace `API_KEY` with your actual API Key from your Datadog Account. |
| 24 | +``` |
| 25 | +kubectl create secret generic datadog-api --from-literal=token=API_KEY |
| 26 | +``` |
| 27 | + |
| 28 | +## Deploy to minikube |
| 29 | +- Run: |
| 30 | + ``` |
| 31 | + kubectl apply -f postgres_deployment.yaml -f flask_deploy.yaml -f datadog-agent.yaml -f kubernetes |
| 32 | + ``` |
| 33 | + |
| 34 | +## Confirm it works & generate traffic |
| 35 | +- Grab the `CLUSTER-IP` for flaskapp: |
| 36 | + - `kubectl get services` |
| 37 | + - Example output: |
| 38 | + ``` |
| 39 | + ⇒ kubectl get services |
| 40 | + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE |
| 41 | + flaskapp ClusterIP 10.104.65.215 <none> 5005/TCP 3m11s |
| 42 | + kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 32m |
| 43 | + postgres ClusterIP 10.99.143.193 <none> 5432/TCP 3m11s |
| 44 | + ``` |
| 45 | +- `minikube ssh` |
| 46 | +- Hit the flash endpoints: |
| 47 | + ``` |
| 48 | + curl http://CLUSTER-IP:5005/ |
| 49 | + curl http://CLUSTER-IP:5005/bad |
| 50 | + curl http://CLUSTER-IP:5005/query |
| 51 | + curl http://CLUSTER-IP:5005/log |
| 52 | + ``` |
| 53 | + |
| 54 | +### Observe in Datadog |
| 55 | +In a few minutes, you should be able to see metrics, traces, hosts, logs, etc: |
| 56 | +- [metric summary page](https://app.datadoghq.com/metric/summary) |
| 57 | +- [host map](https://app.datadoghq.com/infrastructure/map) |
| 58 | +- [Traces](https://app.datadoghq.com/apm/search) |
| 59 | +- [Logs](https://app.datadoghq.com/logs) |
| 60 | +- [processes](https://app.datadoghq.com/process) |
| 61 | +- [Postgres OOTB Dashboard](https://app.datadoghq.com/screen/integration/235/) |
| 62 | +- etc... |
0 commit comments