Mejoras de sesion: estabilizacion, IA, Nexus Yonke y marketplace B2B
- F0 blindaje: Redis/Celery, pg_hba sin trust LAN, secretos a env 600, backups, webhook auth, jobs muertos - F1 caja: bugs POS, reembolsos al corte, apartados, CFDI, topes de descuento en cotizacion/apartado - F2/F7 IA de catalogo: autocategorizacion, dedup de SKUs con embeddings, OCR de facturas, descripciones, claves SAT, limpieza de fitment - F3 IA en el flujo: vision Yonke, preguntas MeLi, venta cruzada, anomalias, sinonimos, busqueda semantica (rerank/embeddings) - F4/F8 escala y cartera: /metrics+Prometheus+Grafana, pool, score de credito, churn, metricas multi-tenant - Nexus Yonke (M1-M6): modelo de datos 1-de-1, alta por donador, vitrina publica, MeLi usado, consignacion, garantia por dias, reportes, etiquetas - Marketplace B2B entre yonkes (catalogo + pedidos cross-tenant) - Seguridad: auth en /api/admin/* (35 endpoints), alertas por tenant - Migraciones v4.27/v4.28; timers expire-demos y rollup-metrics
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
global:
|
||||
smtp_smarthost: 'localhost:587'
|
||||
smtp_from: 'alerts@nexus.local'
|
||||
smtp_require_tls: false
|
||||
resolve_timeout: 5m
|
||||
|
||||
route:
|
||||
group_by: ['alertname', 'severity']
|
||||
@@ -12,19 +10,14 @@ route:
|
||||
|
||||
receivers:
|
||||
- name: 'default'
|
||||
email_configs:
|
||||
- to: 'admin@nexus.local'
|
||||
subject: 'Nexus Alert: {{ .GroupLabels.alertname }}'
|
||||
body: |
|
||||
{{ range .Alerts }}
|
||||
Alert: {{ .Annotations.summary }}
|
||||
Description: {{ .Annotations.description }}
|
||||
Severity: {{ .Labels.severity }}
|
||||
Time: {{ .StartsAt }}
|
||||
{{ end }}
|
||||
webhook_configs:
|
||||
- url: 'http://localhost:5001/pos/api/notifications/webhook'
|
||||
# El contenedor llega al host por el gateway del bridge docker
|
||||
- url: 'http://172.17.0.1:5001/pos/api/notifications/webhook'
|
||||
send_resolved: true
|
||||
http_config:
|
||||
authorization:
|
||||
type: Bearer
|
||||
credentials: 'c58db62766712e618a881dbe8de580960812e57a069ef92c9dd00e7e69158cb2'
|
||||
|
||||
inhibit_rules:
|
||||
- source_match:
|
||||
|
||||
@@ -3,6 +3,8 @@ version: "3.8"
|
||||
services:
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.51.0
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
container_name: nexus-prometheus
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"uid": "nexus-app",
|
||||
"title": "Nexus — Application",
|
||||
"tags": ["gunicorn", "flask"],
|
||||
"tags": ["app", "flask", "nexus"],
|
||||
"timezone": "browser",
|
||||
"schemaVersion": 36,
|
||||
"refresh": "30s",
|
||||
@@ -26,15 +26,15 @@
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Request Rate (nginx)",
|
||||
"title": "Request Rate (by app / status)",
|
||||
"type": "timeseries",
|
||||
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"expr": "rate(nginx_http_requests_total[5m])",
|
||||
"legendFormat": "Requests/sec",
|
||||
"expr": "sum by (app, status) (rate(nexus_http_requests_total[5m]))",
|
||||
"legendFormat": "{{app}} {{status}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
@@ -49,20 +49,20 @@
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Response Time (nginx)",
|
||||
"title": "Response Time p95 / p99",
|
||||
"type": "timeseries",
|
||||
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"expr": "histogram_quantile(0.95, sum(rate(nginx_http_request_duration_seconds_bucket[5m])) by (le))",
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(nexus_http_request_duration_seconds_bucket[5m])))",
|
||||
"legendFormat": "p95",
|
||||
"refId": "A"
|
||||
},
|
||||
{
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"expr": "histogram_quantile(0.99, sum(rate(nginx_http_request_duration_seconds_bucket[5m])) by (le))",
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(nexus_http_request_duration_seconds_bucket[5m])))",
|
||||
"legendFormat": "p99",
|
||||
"refId": "B"
|
||||
}
|
||||
@@ -78,15 +78,15 @@
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Active Workers",
|
||||
"title": "In-flight Requests",
|
||||
"type": "timeseries",
|
||||
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 8},
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"expr": "count by (instance) (node_processes_state{state=\"S\", cmdline=~\".*gunicorn.*\"})",
|
||||
"legendFormat": "Workers {{instance}}",
|
||||
"expr": "sum by (app) (nexus_http_requests_in_flight)",
|
||||
"legendFormat": "{{app}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
@@ -108,8 +108,8 @@
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"expr": "rate(nginx_http_requests_total{status=~\"5..\"}[5m])",
|
||||
"legendFormat": "5xx/sec",
|
||||
"expr": "sum by (app) (rate(nexus_http_requests_total{status=\"5xx\"}[5m]))",
|
||||
"legendFormat": "{{app}} 5xx/s",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
@@ -124,22 +124,22 @@
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Memory per Worker",
|
||||
"title": "Master DB Connections",
|
||||
"type": "timeseries",
|
||||
"gridPos": {"h": 8, "w": 24, "x": 0, "y": 16},
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {"type": "prometheus", "uid": "${datasource}"},
|
||||
"expr": "process_resident_memory_bytes{cmdline=~\".*gunicorn.*\"} / 1024 / 1024",
|
||||
"legendFormat": "{{cmdline}}",
|
||||
"expr": "nexus_db_connections",
|
||||
"legendFormat": "{{app}} ({{database}})",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {"drawStyle": "line", "lineWidth": 2, "fillOpacity": 10},
|
||||
"unit": "mbytes",
|
||||
"unit": "short",
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
|
||||
@@ -19,7 +19,7 @@ scrape_configs:
|
||||
|
||||
- job_name: 'node'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
- targets: ['host.docker.internal:9100']
|
||||
|
||||
- job_name: 'postgres'
|
||||
static_configs:
|
||||
@@ -29,12 +29,16 @@ scrape_configs:
|
||||
static_configs:
|
||||
- targets: ['redis-exporter:9121']
|
||||
|
||||
- job_name: 'nexus-pos'
|
||||
static_configs:
|
||||
- targets: ['host.docker.internal:5001']
|
||||
# Métricas de aplicación expuestas por POS (gunicorn :5001) y dashboard (:5000)
|
||||
# en el host; se alcanzan desde el contenedor por el gateway del bridge docker.
|
||||
- job_name: 'nexus_pos'
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets: ['172.17.0.1:5001']
|
||||
|
||||
- job_name: 'nexus-quart'
|
||||
static_configs:
|
||||
- targets: ['host.docker.internal:5002']
|
||||
- job_name: 'nexus_dashboard'
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets: ['172.17.0.1:5000']
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user