Skip to content

Serve the namespace system metrics like published PHP 2.11 - #684

Closed
rmcdaniel wants to merge 1 commit into
rust-325-train-oct22cfrom
rust-325-system-metrics
Closed

rmcdaniel wants to merge 1 commit into
rust-325-train-oct22cfrom
rust-325-system-metrics

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Part of #325. Stacked on train #675.

Summary

Native now serves GET|POST /api/system/metrics as published Server 2.11 does (SystemController::metrics). The CLI and operators read it for the namespace's health. It reports:

  • the namespace's workflow task failures, by workflow type, capped at 20 types with the rest disclosed;
  • server-wide projection drift;
  • the namespace's request admission, durable-state (16 resources) and external payload usage.

Each family carries PHP's bounded label policy, and the cardinality summary repeats them.

Native enforces no namespace admission, durable-state or payload quota, and its configuration audit refuses settings that would configure one. So limits and remaining values are null and rejection counters zero, as on an unconfigured PHP server. Usage is measured.

Projection drift reuses the same source as PHP: the operator snapshot's per-table needs_rebuild. Native keeps run waits in the history transaction and derives timeline, timer and lineage views from history, so its only drift source is a run without its summary.

Fixture first

The new system-metrics fixture (fresh namespace, raw HTTP) registers a worker, starts two runs of two types, fails one workflow task and creates a schedule, then reads by GET and POST. Namespace-scoped values are exact. Drift is server-wide and counts stale or orphaned rows that other fixtures leave, so it is checked for its fixed table inventory, non-negative counts and consistent totals.

The fixture found a native gap: failing a workflow task in a named namespace answered 422 development_namespace_operation_unqualified, and the store refused its retry outside default. The failed task is read within the request's namespace, and its retry copies the run's namespace, so both gates are removed. A new test fails a task in one namespace, shows the other namespace cannot fail or poll it, and polls the retry (attempt 2) in its own namespace.

Verification

  • Local three-way parity on published PHP 2.11.1, embedded and native: all 52 fixtures pass on each target, including system-metrics.
  • Native suite on SQLite with --all-targets: 647 passed. The new metrics and named-namespace tests also pass on PostgreSQL and MySQL. PostgreSQL first failed: MAX(attempt_count) keeps the integer column's width, so it is now decoded by row.
  • Contract unit test: 22 cases, including mutations.

The port log now marks namespace delete and the JSON metrics as served. The Prometheus summary is a separate PR.

GET|POST /api/system/metrics reports the namespace's workflow task
failures, server-wide projection drift, and the namespace's request
admission, durable-state and external payload usage, each with PHP's
bounded label policy. Native enforces none of those quotas, so limits are
null and rejection counters zero, as on an unconfigured PHP server.

The new system-metrics fixture fails a workflow task in a named namespace,
which native refused. That failure, and its retry, are scoped to the
task's namespace, so named namespaces now accept it.
@rmcdaniel

Copy link
Copy Markdown
Member Author

Superseded by #696, which carries this change unchanged, rebased on main. This PR closed when its base branch (the merged #675 train) was deleted. Its tests pass in #696 on SQLite, PostgreSQL and MySQL.

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