Files
ServerKit/backend/tests/test_observability_namespace.py
T
Juan DenisandClaude Opus 4.8 b00fff7759 refactor(unify): §4 — one Observability namespace + tab group
Backend:
- The monitoring / metrics / telemetry(events) / uptime / fleet / status-page
  read surfaces are re-mounted under /api/v1/observability/<domain> as true
  aliases (same blueprints, distinct names). Original prefixes stay; the public
  status page route /api/v1/status/public/<slug> is untouched.

Frontend:
- The Monitoring tab group becomes "Observability": Monitoring · Events
  (the SystemEvent stream, formerly the standalone "Telemetry" page) · Status
  Pages, sharing one PageTopbar. /observability lands on Monitoring.
- The standalone Telemetry route + sidebar item are folded into the group
  (sidebar "Monitoring" → "Observability"; Events covered by matchPrefixes;
  removed from ADVANCED_ITEM_IDS). Command palette updated.
- Fleet Monitor stays under Servers (server-scoped) and GPU stays its own
  hardware page — intentional, per the plan.

Deferred (plan §4 deep merge, documented): the unified events/metrics/checks/
alerts/thresholds tables + collector migration into the job system. The
read-surface namespace + IA consolidation ship now; the schema merge is a large
data migration best done against a live metrics store.

Verified: 3 backend namespace tests + telemetry suite pass (22); frontend build
+ eslint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 14:58:55 -04:00

38 lines
1.7 KiB
Python

"""§4 unification — one /api/v1/observability namespace.
The monitoring / metrics / telemetry(events) / uptime / fleet / status-page read
surfaces are re-mounted under /api/v1/observability/<domain> as true aliases.
The original prefixes and the public status page route stay intact.
"""
def test_observability_aliases_registered():
from app import create_app
application = create_app('testing')
rules = {r.rule for r in application.url_map.iter_rules()}
assert any(r.startswith('/api/v1/observability/monitoring') for r in rules)
assert any(r.startswith('/api/v1/observability/metrics') for r in rules)
assert any(r.startswith('/api/v1/observability/events') for r in rules)
assert any(r.startswith('/api/v1/observability/uptime') for r in rules)
assert any(r.startswith('/api/v1/observability/fleet') for r in rules)
assert any(r.startswith('/api/v1/observability/status-pages') for r in rules)
def test_original_prefixes_still_present():
from app import create_app
application = create_app('testing')
rules = {r.rule for r in application.url_map.iter_rules()}
assert any(r.startswith('/api/v1/monitoring') for r in rules)
assert any(r.startswith('/api/v1/telemetry') for r in rules)
assert any(r.startswith('/api/v1/fleet-monitor') for r in rules)
# Public status page route untouched.
assert '/api/v1/status/public/<slug>' in rules
def test_events_alias_matches_telemetry(app, client, auth_headers):
canonical = client.get('/api/v1/telemetry/events', headers=auth_headers)
alias = client.get('/api/v1/observability/events/events', headers=auth_headers)
assert canonical.status_code == 200
assert alias.status_code == 200
assert alias.get_json() == canonical.get_json()