feat(telemetry): add isolated beta quality diagnostics and release identity

This commit is contained in:
dadachann
2026-09-15 09:35:01 +00:00
parent 91d6de8858
commit f8123ead0a
89 changed files with 4205 additions and 175 deletions
+4
View File
@@ -597,6 +597,10 @@ class Application:
if self.telemetry is not None:
with contextlib.suppress(Exception):
await self.telemetry.shutdown()
diagnostics_manager = getattr(self, 'diagnostics', None)
if diagnostics_manager is not None:
with contextlib.suppress(Exception):
await diagnostics_manager.shutdown()
if self.vector_db_mgr is not None:
with contextlib.suppress(Exception):
await self.vector_db_mgr.shutdown()
+28 -1
View File
@@ -7,6 +7,7 @@ import os
from . import app
from . import stage
from ..telemetry import diagnostics
from ..utils import constants, importutil
# Import startup stage implementation to register
@@ -39,7 +40,33 @@ async def make_app(loop: asyncio.AbstractEventLoop) -> app.Application:
stage_cls = stage.preregistered_stages[stage_name]
stage_inst = stage_cls()
await stage_inst.run(ap)
if stage_name == 'GenKeysStage':
# Optional diagnostics must not make startup depend on package
# metadata, session markers, or its background transport.
ap.diagnostics = None
space_config = ap.instance_config.data.get('space', {})
if not space_config.get('disable_telemetry', False) and not space_config.get(
'disable_beta_diagnostics', False
):
manager = None
try:
manager = diagnostics.DiagnosticsManager(ap, marker_path='data/labels/beta_diagnostics_session')
await manager.start_session()
manager.start()
ap.diagnostics = manager
except BaseException as exc:
if manager is not None:
# Cleanup faults cannot replace the startup fault.
try:
await manager.shutdown(drain_timeout=0)
except asyncio.CancelledError:
if not isinstance(exc, asyncio.CancelledError):
raise
except Exception:
pass
if not isinstance(exc, Exception):
raise
await diagnostics.observe('lifecycle', 'startup.' + stage_name, source='startup', ap=ap)(stage_inst.run)(ap)
await ap.initialize()
except BaseException: