stuffies
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Metrics API Examples
|
||||
|
||||
## Registrar métrica manualmente
|
||||
## Record Metric (Manual)
|
||||
```bash
|
||||
curl -X POST "http://localhost:8004/metrics/record" \
|
||||
-H "Content-Type: application/json" \
|
||||
@@ -13,29 +13,74 @@ curl -X POST "http://localhost:8004/metrics/record" \
|
||||
}'
|
||||
```
|
||||
|
||||
## Obtener reporte de últimos 7 días
|
||||
## Get Analytics Report (Last N Days)
|
||||
```bash
|
||||
curl "http://localhost:8004/metrics/report?days=7"
|
||||
```
|
||||
|
||||
## Obtener estadísticas de un día específico
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"start_date": "2026-04-27T00:00:00",
|
||||
"end_date": "2026-05-04T23:59:59",
|
||||
"total_events": 245,
|
||||
"events_by_type": {
|
||||
"user_created": 12,
|
||||
"report_created": 45,
|
||||
"notification_sent": 188
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Get Daily Statistics
|
||||
```bash
|
||||
curl "http://localhost:8004/metrics/daily-stats?date=2026-05-04T00:00:00"
|
||||
```
|
||||
|
||||
## Obtener resumen de eventos en rango
|
||||
Response:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"date": "2026-05-04T00:00:00",
|
||||
"event_type": "user_created",
|
||||
"count": 3
|
||||
},
|
||||
{
|
||||
"date": "2026-05-04T00:00:00",
|
||||
"event_type": "report_created",
|
||||
"count": 8
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Get Event Summary (Date Range)
|
||||
```bash
|
||||
curl "http://localhost:8004/metrics/summary?start_date=2026-04-27T00:00:00&end_date=2026-05-04T23:59:59"
|
||||
```
|
||||
|
||||
## Health check
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"summary": {
|
||||
"user_created": 12,
|
||||
"report_created": 45,
|
||||
"notification_sent": 188,
|
||||
"moderation_completed": 5
|
||||
},
|
||||
"date_range": {
|
||||
"start_date": "2026-04-27T00:00:00",
|
||||
"end_date": "2026-05-04T23:59:59"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Health Check
|
||||
```bash
|
||||
curl "http://localhost:8004/metrics/health"
|
||||
```
|
||||
|
||||
## Eventos automáticos (RabbitMQ)
|
||||
El consumer de métricas escucha automáticamente eventos de:
|
||||
- Users Queue: `user_created`, `user_updated`, `user_deleted`
|
||||
- Reports Queue: `report_created`, `report_resolved`
|
||||
- Notifications Queue: `notification_sent`
|
||||
- Moderations Queue: `moderation_completed`
|
||||
## Automatic Events (RabbitMQ)
|
||||
- `user_created`, `user_updated`, `user_deleted`
|
||||
- `report_created`, `report_resolved`
|
||||
- `notification_sent`
|
||||
- `moderation_completed`
|
||||
|
||||
Reference in New Issue
Block a user