Skip to content

feat(portal): enable vendored telemetry (/events + /metrics) - #66

Merged
EdgarSocrates98 merged 6 commits into
mainfrom
feat/portal-telemetry
Oct 18, 2026
Merged

EdgarSocrates98 merged 6 commits into
mainfrom
feat/portal-telemetry

Conversation

@EdgarSocrates98

Copy link
Copy Markdown
Owner

What

Wires the vendored _portal_telemetry.py (forge/PortalEvent/1) into PlatformForgePortal:

  • self._telemetry_recorder = _pt.EventRecorder() + self.event_sink = self._telemetry_recorder.emit — PortalServer picks the sink up automatically, so every op boundary is recorded for free (operation.start / operation.end with correlation_id, status, duration_ms, plus request.rejected refusals).
  • *_pt.operations(recorder, self) — adds read-only GET /api/v1/events (full forge/PortalEventReport/1 window with correlation_id/type/status/limit filters) and GET /api/v1/metrics (the §5.4 MetricsReport projection).
  • _pt.task_events_op(recorder, lambda: list(self._tasks)) — GET /api/v1/tasks/{task_id}/events, joining the existing /tasks surface (links via metadata.task_id or the task's own correlation_id, never timing guesses).

Also commits the vendored module itself + the portal/manifest.json telemetry hash entries, and re-binds the economy receipt validated_sha to the branch base (HEAD~1) per the receipt contract.

Evidence

  • New real-HTTP test test_telemetria_events_e_metrics (authenticated GET /api/v1/health → GET /api/v1/events returns the recorded operation.end event with schema/correlation_id/status/duration_ms → GET /api/v1/metrics returns the report envelope with counters).
  • pytest tests/test_portal_adapter.py — 19 passed.
  • pytest tests/test_economy_closure.py — 33 passed; scripts/validate.py --gate economy-receipt — PASS.
  • ruff check . — clean.

Empty buffer returns [] honestly; events live in a bounded in-process buffer (capacity 500), nothing leaves the machine.

Wire the vendored _portal_telemetry (forge/PortalEvent/1) into the
portal adapter: EventRecorder as adapter.event_sink so PortalServer
records every op boundary (operation.start/end, request.rejected),
plus the GET /events and GET /metrics read ops. A GET
/tasks/{task_id}/events op joins the existing /tasks surface.

Includes the vendored module + portal/manifest.json telemetry hash
entries, and re-binds the economy receipt validated_sha to the branch
base (HEAD~1). Real-HTTP coverage in test_telemetria_events_e_metrics.
@EdgarSocrates98
EdgarSocrates98 merged commit 728d6e3 into main Oct 18, 2026
5 checks passed
@EdgarSocrates98
EdgarSocrates98 deleted the feat/portal-telemetry branch October 18, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant