Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

notifications: scoped weekly metrics mail per rule

Abierto
#2,116 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 2 días

@alanpeixinho ya está trabajando en esto.

Desde el 22/10/2026.

  • #2194 de @alanpeixinho — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
64/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python, sql

Línea de trabajo

Comienza en backend/data/notifications/metrics/ e inspecciona el flujo de las reglas de métricas y metrics_report.txt.j2; después, revisa docs/notifications.md y el comportamiento existente del trabajo semanal. Verifica que el correo global predeterminado no cambie, que los informes con ámbito lleguen únicamente a los destinatarios de cada regla, que los ámbitos configurados estén cubiertos por el calentamiento de la caché y que el impacto en las consultas y la caché esté documentado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

notifications

Problem

The Saturday metrics_summary cron sends one global report to [email protected], Cc [email protected]. A lab or an origin cannot get its own copy.

Change

New directory backend/data/notifications/metrics/, created by this issue. Each rule sends one extra metrics_report.txt.j2 after the community mail on the weekly run.

# metrics/collabora.yaml — one file per rule group, rule name as top-level key
collabora-labs:
  origins: [maestro]
  labs: [lava-collabora]
  period_days: 7
  to: [[email protected]]
Key Required Effect
to yes, ≥1 RFC 5322 strings, sent unchanged. To of this mail.
period_days yes, > 0 get_metrics_data(start_days_ago=period_days, end_days_ago=0), the same window the community mail uses.
origins no Keeps these keys in build_incidents_by_origin, top_issues_by_origin, new_issues_by_origin.
labs no Keeps these keys in lab_maps and prev_lab_maps.

The accepted keys are exactly those four. get_metrics_data() groups by origin and by lab, so those are the dimensions a rule can scope.

What a reader of a scoped mail sees

The origin sections and the lab table follow the rule. The headline table (Trees monitored, Checkouts, Builds, Tests) stays project-wide, and the template gains a line saying so. Lab counts span every origin, since the lab queries group by lab and status; document this next to the labs key.

Implementation

  1. typeModels/metricsRules.py: MetricsRule (pydantic, extra="forbid"), loader over metrics/*.yaml. Rule names are unique across files. Errors carry file, rule, and key, matching #2114's loader.
  2. generate_metrics_report: load the rules, call get_metrics_data once per distinct period_days with today's use_cache default, then per rule model_copy(update=...) on the five dicts. Filter before compute_metrics_deltas so deltas.labs, new_lab_keys, extinct_lab_keys, and n_total_lab_activity describe the filtered set. Send one mail per rule, To from to.
  3. metrics_report.txt.j2: mark the headline table as project-wide.
  4. docs/notifications.md: the directory, the four keys, and the scope of each section.

A rule with period_days: 7 reuses the 6-hour cache entries the community mail populates in the same run; other values cost six queries. warm_metrics_cache serves the dashboard and stays as it is.

Tests

Loader fixtures: valid rule, duplicate name across files, unknown key, empty to, period_days: 0. Report fixtures on a MetricsReportData instance: origins keeps only those origins; labs keeps only those labs and recomputes deltas, including dropping an extinct lab outside the rule; a rule naming a lab absent from the period renders without it. One test loads the real metrics/ directory so a committed rule file is validated in CI.

Acceptance

  • With no rule files, the community mail matches today
  • A rule sends one mail to its to, with only its origins in the origin sections and only its labs in the lab table
  • Lab deltas and the new and extinct markers describe the filtered set
  • An invalid rule file fails CI with file, rule, and key

Creates the metrics/ directory. Independent of #2114 and #2115.

Lenguaje dominante
Python
Estrellas
10
Forks
32
Merge medio
4 d 2 h
PR fusionados (30 d)
30

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de kernelci/dashboard

Todos los issues de kernelci/dashboard

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.