NutriFlow Datadog Observability

Infraestructura · APM · Logs · Alertas · Dashboards
production staging nuevo setup
Agente: 2 hosts activos
APM: 3 servicios trazados
Monitores: 1 en warning
Logs: 4.2K eventos/min
Integraciones: 4 activas
Actualizado: hace 32s
Métricas Clave — Últimas 24h
Req Rate (web-api)
847/min
↑ +12% vs ayer
P99 Latencia ML Engine
1.84s
⚠ umbral: 2.0s
Error Rate Payment
0.3%
✓ bajo umbral (1%)
CPU Avg (ambos hosts)
42%
✓ warning: 70%
Redis Cache Hit Rate
94%
✓ warning: 80%
🖥 Hosts monitorizados 2 online
🌐
web-server-01
AWS EC2 · t3.medium · Ubuntu 22.04 · env:production
38%
CPU
62%
RAM
18%
Disco
OK
🤖
ml-server-01
AWS EC2 · g4dn.xlarge · Ubuntu 22.04 · env:production
67%
CPU
78%
RAM
44%
Disco
WARN
🔔 Monitores activos 1 warning
Monitor Umbral Estado Alerta a
CPU alto — {{host.name}}
avg:system.cpu.user{env:production} by {host}
70% / 85% WARNING #slack-ops
Error spike payment-service
logs("service:payment-service status:error")
25 / 50 OK #slack-payments
P99 Latencia ML Engine
p99:trace.http.request.duration{service:ml-engine}
1.5s / 2.0s OK #slack-ml-team
Conexiones PostgreSQL
avg:postgresql.connections{env:production}
80 / 100 OK #pagerduty
Redis Cache Hit Rate bajo
avg:redis.stats.keyspace_hits{*} / total_cmds
<80% OK #slack-infra
🔬 APM — Traza de Servicios (P99) ddtrace-run
POST /api/v1/plans/recommend — duración total: 3.2s
web-api
3.200ms
3.200ms
→ auth-middleware
160ms
160ms
→ ml-engine
1.840ms
1.840ms ⚠
→ model.predict
1.540ms
1.540ms
→ postgres.query
280ms
280ms
→ payment-service
1.200ms
1.200ms
→ stripe.charge
980ms
980ms
Bottleneck detectado: ml-engine > model.predict consume 48% del tiempo total. Revisar batch size y caché de predicciones en Redis.
📋 Event Feed — Últimas 24h 12 eventos
⚠️
CPU warning en ml-server-01
avg:system.cpu.user = 67% (umbral warning: 70%) · host:ml-server-01
hace 8 minutos · Notificado → #slack-ops-alerts
Recuperado: payment-service error rate
Error rate bajó de 1.2% → 0.3% tras deploy v2.4.1
hace 2 horas · Auto-resolved
🚨
CRITICAL: payment-service — 58 errores/5min
service:payment-service status:error · rate 58 > 50 · provider:stripe timeout
hace 6 horas · @pagerduty-infra activado
🔵
Deploy detectado: ml-engine v1.8.2
Evento de deployment registrado. Comparando métricas pre/post deploy.
hace 8 horas · service:ml-engine
Agente instalado en ml-server-01
Datadog Agent 7.52.1 activo · APM + Logs + Process Collection habilitados
hace 12 horas · Setup inicial NutriFlow
Integración PostgreSQL configurada
collect_activity_metrics=true · 14 métricas nuevas disponibles
hace 13 horas · host:web-server-01
Integraciones Configuradas
🐘
PostgreSQL 15
✓ Activa · 14 métricas · RDS
🟢
Nginx 1.24
✓ Activa · nginx_status habilitado
Redis 7
✓ Activa · keyspace + memory
AWS EC2
✓ Activa · CloudWatch integrado
Configuración del Agente
⚙ datadog.yaml — web-server-01 production
/etc/datadog-agent/datadog.yaml
api_key: "dd-api-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" site: "datadoghq.com" hostname: "web-server-01" tags: - env:production - service:web-api - team:platform - project:nutriflow logs_enabled: true apm_config: enabled: true env: production process_config: process_collection: enabled: true
/etc/datadog-agent/conf.d/postgres.d/conf.yaml
instances: - host: nutriflow-rds.cluster.eu-west-1.rds.amazonaws.com port: 5432 username: datadog_readonly dbname: nutriflow_production tags: - env:production - service:database collect_activity_metrics: true collect_database_size_metrics: true
🐍 APM — payment-service (ddtrace) Python / Flask
payment_service/app.py
from ddtrace import tracer, patch_all # Auto-patching: requests, flask, sqlalchemy, redis patch_all() tracer.configure( hostname="localhost", port=8126, service="payment-service", env="production", version="2.4.1", ) app = Flask(__name__) @app.route("/charge", methods=["POST"]) def charge(): with tracer.trace("payment.process", service="payment-service") as span: span.set_tag("payment.provider", "stripe") result = process_payment() span.set_metric("payment.amount", result["amount"]) return {"status": "ok"}
Dockerfile / entrypoint
# Instalar ddtrace pip install ddtrace # Arrancar con auto-instrumentation ddtrace-run gunicorn app:app \ --workers 4 \ --bind 0.0.0.0:5000