feat(monitoring): metricas dos tenants vendidos, e o alerta de fila do Asaas pausada

This commit is contained in:
deploy
2026-09-26 03:03:12 +00:00
parent 1c7dbcad87
commit 7da0883262
22 changed files with 128 additions and 20 deletions
+4 -1
View File
@@ -58,6 +58,9 @@ kind: Service
metadata:
name: runtime-core
namespace: {{TENANT}}-prod
labels:
app: runtime-core
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-core }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -83,6 +83,9 @@ kind: Service
metadata:
name: runtime-operacao
namespace: {{TENANT}}-prod
labels:
app: runtime-operacao
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-operacao }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -61,6 +61,9 @@ kind: Service
metadata:
name: runtime-saude
namespace: {{TENANT}}-prod
labels:
app: runtime-saude
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-saude }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -84,6 +84,9 @@ kind: Service
metadata:
name: servico-bff
namespace: {{TENANT}}-prod
labels:
app: servico-bff
athleticmap.io/metricas: tenant
spec:
selector: { app: servico-bff }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -191,3 +191,21 @@ spec:
annotations:
summary: "{{ $labels.deployment }} sem replica disponivel — demo, piloto e acme dependem dele"
description: "Os tres tenants migrados param juntos. kubectl -n plataforma-prod get pods -l app={{ $labels.deployment }} e, se for o PgBouncer, lembre que a userlist e montada por subPath e so entra em vigor com restart."
- name: athleticmap.asaas
rules:
# Depois de 15 falhas seguidas o Asaas PAUSA a fila de avisos: os
# eventos ficam guardados 14 dias e depois somem. Nada quebra do nosso
# lado — so para de chegar pagamento. As vigias ja tentam reativar
# (no maximo 1x a cada 6 h); se ainda estiver pausada 30 min depois, a
# causa persiste e alguem tem de olhar o endpoint.
- alert: AthleticMapFilaDoAsaasPausada
expr: max by (namespace, origem) (atm_asaas_filas_pausadas) > 0
for: 30m
labels:
severity: critical
annotations:
summary: "Fila de avisos do Asaas pausada em {{ $labels.namespace }}"
description: >-
O Asaas parou de mandar avisos ({{ $labels.origem }}). Os guardados
somem em 14 dias. Veja o log (fila de avisos do Asaas PAUSADA) e o
endpoint de webhook; reativar: Integracoes > Webhooks > Remover penalidade.
@@ -0,0 +1,30 @@
# =============================================================================
# As metricas dos tenants VENDIDOS — os que nascem do molde.
#
# Por ROTULO, e nao por nome de namespace: o `athleticmap-runtimes` lista
# demo/piloto/acme pelo nome, e todo tenant novo ficava de fora (medido em
# 2026-09-26: teste5 e zico-0 sem nenhuma metrica). O rotulo vem do molde.
# Ver scripts/metricas_dos_tenants_e_filas.py.
# =============================================================================
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: athleticmap-tenants
namespace: monitoring
labels:
release: monitoring
spec:
namespaceSelector:
any: true
selector:
matchLabels:
athleticmap.io/metricas: tenant
endpoints:
- port: http
path: /actuator/prometheus
interval: 60s
scrapeTimeout: 20s
metricRelabelings:
- sourceLabels: [__name__]
regex: "atm_.*|up|jvm_memory_used_bytes|jvm_memory_max_bytes|jvm_threads_live_threads|process_cpu_usage|system_cpu_usage|http_server_requests_seconds_count|http_server_requests_seconds_sum|http_server_requests_seconds_max|hikaricp_connections_active|hikaricp_connections_pending|hikaricp_connections_max|flyway_migrations_.*|application_ready_time_seconds"
action: keep
@@ -58,6 +58,9 @@ kind: Service
metadata:
name: runtime-core
namespace: escolinha-de-teste-2-prod
labels:
app: runtime-core
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-core }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -83,6 +83,9 @@ kind: Service
metadata:
name: runtime-operacao
namespace: escolinha-de-teste-2-prod
labels:
app: runtime-operacao
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-operacao }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -61,6 +61,9 @@ kind: Service
metadata:
name: runtime-saude
namespace: escolinha-de-teste-2-prod
labels:
app: runtime-saude
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-saude }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -84,6 +84,9 @@ kind: Service
metadata:
name: servico-bff
namespace: escolinha-de-teste-2-prod
labels:
app: servico-bff
athleticmap.io/metricas: tenant
spec:
selector: { app: servico-bff }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -58,6 +58,9 @@ kind: Service
metadata:
name: runtime-core
namespace: escolinha-de-teste-prod
labels:
app: runtime-core
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-core }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -83,6 +83,9 @@ kind: Service
metadata:
name: runtime-operacao
namespace: escolinha-de-teste-prod
labels:
app: runtime-operacao
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-operacao }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -61,6 +61,9 @@ kind: Service
metadata:
name: runtime-saude
namespace: escolinha-de-teste-prod
labels:
app: runtime-saude
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-saude }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
@@ -84,6 +84,9 @@ kind: Service
metadata:
name: servico-bff
namespace: escolinha-de-teste-prod
labels:
app: servico-bff
athleticmap.io/metricas: tenant
spec:
selector: { app: servico-bff }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -58,6 +58,9 @@ kind: Service
metadata:
name: runtime-core
namespace: teste5-prod
labels:
app: runtime-core
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-core }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -83,6 +83,9 @@ kind: Service
metadata:
name: runtime-operacao
namespace: teste5-prod
labels:
app: runtime-operacao
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-operacao }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -61,6 +61,9 @@ kind: Service
metadata:
name: runtime-saude
namespace: teste5-prod
labels:
app: runtime-saude
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-saude }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -84,6 +84,9 @@ kind: Service
metadata:
name: servico-bff
namespace: teste5-prod
labels:
app: servico-bff
athleticmap.io/metricas: tenant
spec:
selector: { app: servico-bff }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -58,6 +58,9 @@ kind: Service
metadata:
name: runtime-core
namespace: zico-0-prod
labels:
app: runtime-core
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-core }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -83,6 +83,9 @@ kind: Service
metadata:
name: runtime-operacao
namespace: zico-0-prod
labels:
app: runtime-operacao
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-operacao }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -61,6 +61,9 @@ kind: Service
metadata:
name: runtime-saude
namespace: zico-0-prod
labels:
app: runtime-saude
athleticmap.io/metricas: tenant
spec:
selector: { app: runtime-saude }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]
+4 -1
View File
@@ -84,6 +84,9 @@ kind: Service
metadata:
name: servico-bff
namespace: zico-0-prod
labels:
app: servico-bff
athleticmap.io/metricas: tenant
spec:
selector: { app: servico-bff }
ports: [{ port: 80, targetPort: 8083 }]
ports: [{ name: http, port: 80, targetPort: 8083 }]