ServiceMap: update dependencies and backend/app (+5 areas)

Public changes compared with the previous published export:
16 files changed.

Affected areas:
- backend/app: 3 files
- dependencies: 5 files
- deployment and CI: 2 files
- documentation: 2 files
- frontend/src: 1 file
- project files: 1 file
- tests: 2 files

Changed files:
- Updated: ".env.example"
- Updated: "Dockerfile.unraid"
- Updated: "README.md"
- Updated: "backend/app/incidents.py"
- Updated: "backend/app/main.py"
- Updated: "backend/app/store.py"
- Updated: "backend/pyproject.toml"
- Updated: "backend/tests/test_docker_provider.py"
- Updated: "backend/tests/test_v163_health_performance.py"
- Updated: "docker-compose.broker.yml"
- Updated: "docs/ARCHITECTURE.md"
- Updated: "frontend/package-lock.json"
- Updated: "frontend/package.json"
- Updated: "frontend/src/App.tsx"
- Updated: "package-lock.json"
- Updated: "package.json"

Export provenance/manifests refreshed; excluded from the change summary.

Publish curated ServiceMap source from 8c297f756ff84aaa917ae9c48535e835f8c09ec7
This commit is contained in:
NuklearRabbit committed 2026-11-20 16:01:36 +01:00
1 parent d4c351ce73
commit 41a8eee259
18 files changed
+167 -92

No files matched your search

+42 -40
View File
@@ -22,8 +22,8 @@ from .discovery_store import DiscoveryStore
from .docker_discovery import discover_containers
from .docker_provider import docker_provider_mode
from .events import SSE_RETRY_MS, event_bus, next_event, sse_payload
from .health import status_maps, topology_health, validate_dependencies
from .incidents import incident_overview, sync_incidents
from .health import TopologyHealth, status_maps, topology_health, validate_dependencies
from .incidents import incident_overview, reconcile_incidents, sync_incidents
from .loops import loop_registry, run_periodic
from .models import (
AvailabilitySummary,
@@ -288,7 +288,7 @@ async def lifespan(_: FastAPI):
await background_task
app = FastAPI(title="ServiceMap API", version="1.6.3", lifespan=lifespan)
app = FastAPI(title="ServiceMap API", version="1.6.4", lifespan=lifespan)
# Bounded request bodies: the largest legitimate payload is a config import.
@@ -404,7 +404,7 @@ def meta() -> dict[str, str | int | float | bool]:
auth_mode = "misconfigured"
return {
"name": "ServiceMap",
"version": "1.6.3",
"version": "1.6.4",
"stage": "v1",
"scheduled_probing": PROBE_INTERVAL > 0,
"probe_interval_seconds": PROBE_INTERVAL,
@@ -488,21 +488,21 @@ def verify_write_access() -> dict[str, bool]:
return {"ok": True}
def _visible_services(services: list[Service]) -> list[Service]:
return [
service for service in services
if service.visibility.value == "visible" and service.lifecycle.value not in {"retired", "ignored"}
]
def _service_snapshots(
*, include_hidden: bool = False, include_context: bool = True
) -> list[ServiceSnapshot]:
*, include_hidden: bool = False, include_details: bool = True
) -> tuple[list[ServiceSnapshot], TopologyHealth]:
all_services = store.list_services()
services = (
all_services
if include_hidden
else [
service
for service in all_services
if service.visibility.value == "visible" and service.lifecycle.value not in {"retired", "ignored"}
]
)
latest = store.latest_probes([service.id for service in services])
availability = store.availability_summaries([service.id for service in services], 24)
services = all_services if include_hidden else _visible_services(all_services)
visible_ids = [service.id for service in services]
latest = store.latest_probes(visible_ids)
availability = store.availability_summaries(visible_ids, 24) if include_details else {}
evidence_by_service = store.health_evidence_for_services([service.id for service in all_services])
# Calculate propagation over the complete canonical graph first. Hidden
# infrastructure nodes may still sit between a visible service and its
@@ -512,15 +512,15 @@ def _service_snapshots(
[service.id for service in all_services], evidence_by_service=evidence_by_service
)
effective_all, dependency_all = status_maps(all_services, direct_statuses=direct_all)
dependent_names = {
service.id: [item.name for item in services if service.id in item.depends_on]
for service in services
}
visible_ids = [service.id for service in services]
windows = store.maintenance_windows()
sources_by_service = discovery_store.sources_for_services(visible_ids) if include_context else {}
relations_by_service = discovery_store.evidence_for_services(visible_ids) if include_context else {}
return [
dependent_names: dict[str, list[str]] = {}
if include_details:
for service in services:
for dependency_id in set(service.depends_on):
dependent_names.setdefault(dependency_id, []).append(service.name)
windows = store.maintenance_windows() if include_details else {}
sources_by_service = discovery_store.sources_for_services(visible_ids) if include_details else {}
relations_by_service = discovery_store.evidence_for_services(visible_ids) if include_details else {}
snapshots = [
ServiceSnapshot(
service=service,
latest_probe=latest.get(service.id),
@@ -539,16 +539,18 @@ def _service_snapshots(
sources=sources_by_service.get(service.id, []),
evidence=relations_by_service.get(service.id, []),
health_evidence=evidence_by_service.get(service.id, []),
health_resolution=resolutions.get(service.id, HealthResolution()),
health_resolution=resolutions.get(service.id) or HealthResolution(),
maintenance_until=windows.get(service.id),
)
for service in services
]
return snapshots, TopologyHealth(all_services, direct_all, effective_all, dependency_all)
@app.get("/api/v1/services", response_model=list[ServiceSnapshot])
def list_services(include_hidden: bool = Query(default=False)) -> list[ServiceSnapshot]:
return _service_snapshots(include_hidden=include_hidden)
snapshots, _ = _service_snapshots(include_hidden=include_hidden)
return snapshots
@app.post("/api/v1/services", response_model=Service, status_code=status.HTTP_201_CREATED)
@@ -768,23 +770,23 @@ async def event_stream() -> StreamingResponse:
@app.get("/api/v1/overview", response_model=OverviewSummary)
def overview() -> OverviewSummary:
sync_incidents(store)
# Only status and coverage are counted; discovery context is not needed.
snapshots = _service_snapshots(include_hidden=False, include_context=False)
overview_state = incident_overview(store)
health, overview_state = reconcile_incidents(store)
services = _visible_services(health.services)
counts: dict[str, int] = {}
coverage: dict[str, int] = {}
for snapshot in snapshots:
counts[snapshot.effective_status.value] = counts.get(snapshot.effective_status.value, 0) + 1
state = snapshot.service.monitoring_state.value
for service in services:
status = health.effective[service.id].value
counts[status] = counts.get(status, 0) + 1
state = service.monitoring_state.value
coverage[state] = coverage.get(state, 0) + 1
services_by_id = {service.id: service for service in health.services}
return OverviewSummary(
generated_at=overview_state.generated_at,
total_services=len(snapshots),
total_services=len(services),
health_counts=counts,
active_incidents=len(store.list_incidents(active_only=True)),
active_incidents=len(store.list_incidents(active_only=True, services=services_by_id)),
likely_root_causes=[candidate.service_name for candidate in overview_state.candidates],
flapping_services=[snapshot.service.name for snapshot in snapshots if snapshot.flapping],
flapping_services=[service.name for service in services if service.flapping],
recent_events=store.list_events(limit=10),
monitoring_coverage=coverage,
)
@@ -982,8 +984,8 @@ def _semantic_representation(include_hidden: bool) -> CachedRepresentation:
cached = semantic_cache.get(cache_key, revision)
if cached is not None:
return cached
snapshots = _service_snapshots(include_hidden=include_hidden, include_context=False)
incident_state = incident_overview(store)
snapshots, health = _service_snapshots(include_hidden=include_hidden, include_details=False)
incident_state = incident_overview(store, health=health)
root_ids = {candidate.service_id for candidate in incident_state.candidates}
affected_ids = {
service_id