mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-27 10:55:21 +08:00
feat(plugin): push plugin runtime ops samples to the Space control plane
The shared Cloud deployment runs one Plugin Runtime for every Workspace, but nothing reported its health: the instance only exposed two aggregate numbers on its own health probe, and the per-installation failure registry, the desired state registry and the reconcile outcome lived in memory with no reader. Add RuntimeOpsReporter, which every 30 seconds reads the Runtime ``/healthz`` probe over HTTP (derived from ``plugin.runtime_ws_url``), merges it with the connector's desired-state, failure and reconcile summaries, and posts one sample to the Space control plane on the existing authenticated direction. Delivery is best-effort and bounded: a single in-flight request, a ten second timeout, dropped samples counted in ``runtime_ops`` on the instance health probe, and a failed probe recorded as a drop so the dashboard shows staleness instead of grading a stale sample as healthy. Cloud-only: a non-cloud deployment never enables the reporter, and the channel is independent of product telemetry so ``space.disable_telemetry`` cannot blind the ops dashboard.
This commit is contained in:
@@ -304,6 +304,11 @@ class Application:
|
||||
if callable(database_snapshot):
|
||||
database_stats = database_snapshot()
|
||||
|
||||
runtime_ops_stats = {}
|
||||
runtime_ops_reporter = getattr(self.plugin_connector, 'runtime_ops_reporter', None)
|
||||
if runtime_ops_reporter is not None:
|
||||
runtime_ops_stats = runtime_ops_reporter.get_stats()
|
||||
|
||||
return {
|
||||
'asyncio_tasks': asyncio_tasks,
|
||||
'event_loop': self.event_loop_monitor.snapshot(),
|
||||
@@ -314,6 +319,7 @@ class Application:
|
||||
'query_pool': query_pool_stats,
|
||||
'models': model_stats,
|
||||
'runtimes': runtime_stats,
|
||||
'runtime_ops': runtime_ops_stats,
|
||||
'telemetry_tasks': len(getattr(self.telemetry, 'send_tasks', ())),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user