Skip to content

refactor: notification metrics come from spans, and NotificationMetrics is gone - #399

Merged
HardMax71 merged 1 commit into
mainfrom
refactor/notification-metrics-from-spans
Oct 18, 2026
Merged

HardMax71 merged 1 commit into
mainfrom
refactor/notification-metrics-from-spans

Conversation

@HardMax71

@HardMax71 HardMax71 commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part of #389, the notifications area. The ten instruments in NotificationMetrics now come from spans, so NotificationService has no meter left.

Changes

Each delivery runs in a notification.deliver span with category, channel, severity, result, error type and delivery seconds. The throttle, each retry and each subscription update leave a one-line notification.throttled, notification.retry or notification.subscription_change span where the metric call was. The collector's signaltometrics connector makes the same ten series from them. Labels take the span attribute names (notification_channel, notification_error, ...), so the notifications dashboard's queries and legends move with them. NotificationService takes trace.Tracer.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling changes

Test Plan

  • Backend unit tests pass (cd backend && uv run pytest tests/unit)
  • Frontend unit tests pass (cd frontend && npm run test)
  • Backend E2E tests pass (docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')
  • Frontend E2E tests pass (cd frontend && npm run test:e2e)
  • API spec and client regenerated if routes or schemas changed (./deploy.sh openapi, then ./deploy.sh types), never edited by hand
  • Manual testing performed

Validation: unit 570 passed (6 span tests), contract 3 passed, e2e 488 passed and 1 skipped. Driving NotificationService from the API container against a local stack (3 in-app deliveries, 1 webhook to a closed port, 2 subscription updates) gave exactly those counts in VictoriaMetrics, with 2 retries and ConnectError on the failure. The throttle path is covered by a unit test only.

Checklist

  • My code follows the project's style guidelines
  • I have run pre-commit run --all-files and all checks pass
  • I have added tests that prove my fix/feature works
  • I have updated documentation if needed
  • My changes don't introduce new warnings

Summary by cubic

Moves notification metrics from NotificationMetrics instruments to spans, with no change to the ten series emitted (part of #389).

Changes

  • Each delivery is a notification.deliver span; the throttle, each retry, and each subscription update emit notification.throttled, notification.retry, and notification.subscription_change spans.
  • The collector's signaltometrics connector derives the ten series from those spans, and label names become the span attribute names; the notifications dashboard moves with them.
  • NotificationService now takes a trace.Tracer instead of a meter, and NotificationMetrics is removed.

Written for commit cec550a. Summary will update on new commits.

View guided diff Turn on auto-fix

…cs is gone

Each delivery is a notification.deliver span with category, channel, severity, result, error and delivery seconds, and the throttle, each retry and each subscription update leave a notification.throttled, notification.retry or notification.subscription_change span. The collector's signaltometrics connector makes the same ten series from them. Labels take the span attribute names, so the notifications dashboard moves with them. Part of #389.
@HardMax71
HardMax71 enabled auto-merge (squash) October 18, 2026 23:00
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 01cd77b5-a28e-4897-8843-8f60e8d6308e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added documentation Improvements or additions to documentation area: realtime SSE streams and notifications area: observability Metrics, dashboards, alerts, logs, traces, OTel collector labels Oct 18, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

codecov-commenter commented Oct 18, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/services/notification_service.py 95.45% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Flag Coverage Δ
backend-e2e 82.81% <59.09%> (-0.03%) ⬇️
backend-unit 73.22% <95.45%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/app/core/metrics/__init__.py 100.00% <ø> (ø)
backend/app/core/providers.py 95.48% <ø> (-0.06%) ⬇️
backend/app/services/notification_service.py 67.20% <95.45%> (+1.87%) ⬆️
Components Coverage Δ
Backend 92.02% <95.45%> (+0.06%) ⬆️
Frontend 92.60% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HardMax71
HardMax71 merged commit 7dbe76f into main Oct 18, 2026
21 checks passed
@HardMax71
HardMax71 deleted the refactor/notification-metrics-from-spans branch October 18, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: observability Metrics, dashboards, alerts, logs, traces, OTel collector area: realtime SSE streams and notifications documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants