You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Server management API: active queries, blocked sessions and lock waits #573
Operate needs to show live activity, but the server currently exposes only health and Prometheus metrics — not the actual active-query, blocked-session or lock-wait state.
Needed
Server endpoints/streams (gRPC + REST) that expose:
currently running queries (session, database, start time, elapsed, SQL preview),
blocked sessions and what they wait on,
lock waits / lock owners.
Respect RBAC (Admin-only) and avoid leaking SQL text of other users where inappropriate.
Verified against the code first: the server exposed health and metrics only — DatabaseController had no
management route, SessionManager had no in-flight SQL, and nothing tracked a database's transaction holder. So the
report was accurate; this is what now exists.
blockedBySession is filled only when another session on the same database actually holds the transaction; it is
left empty rather than guessed.
Recorded on every server path: gRPC ExecuteQuery, gRPC ExecuteNonQuery, REST POST /api/v1/query, REST POST /api/v1/execute, and the BeginTransactionFailedPrecondition branch.
Exposed asGET /api/v1/management/activity — admin only, because the payload names sessions, users and SQL text.
Documented in docs/server/REST_API.md › Management: live activity (with the exact JSON), listed in docs/FEATURE_MATRIX.md, recorded in docs/CHANGELOG.md including the deliberate gaps.
Tests:ManagementActivityTests — 6 cases (entry for the whole scope, truncation, single-line flattening, conflict
with holder, bounded queue, empty-but-well-formed snapshot). Server suite 307/0; Sonar, coverage, codecov and the
three platform builds green on the PR.
What still keeps this open
No gRPC RPC for the snapshot — it needs a proto message + method, the DatabaseService override, the client
call, and an entry in GrpcCapabilityContract (which GrpcCapabilityContractTests would then enforce).
docs/server/REST_API.md (new section + payload), docs/FEATURE_MATRIX.md (row), docs/CHANGELOG.md (Added + Not in this slice). No gRPC contract change was made, so docs/server/GRPC_CAPABILITY_MATRIX.md
needed no edit — and that is stated in the REST section so nobody goes looking for an RPC that does not exist.
Activity
feat(server): instrument writes and the REST query paths in the activ…
Merge pull request #583 from MPCoreDeveloper/feat/573-live-activity
MPCoreDeveloper commentedon Dec 6, 2026
Shipped (first slice,
master6fc8b93 / PR #583)Verified against the code first: the server exposed
healthandmetricsonly —DatabaseControllerhad nomanagement route,
SessionManagerhad no in-flight SQL, and nothing tracked a database's transaction holder. So thereport was accurate; this is what now exists.
ManagementActivityRegistry(SharpCoreDB.Server.Core.Observability) — bounded, in-memory, lossy:BeginTransaction, the database, the user, the holder (when identifiable), the timestampnothing.
blockedBySessionis filled only when another session on the same database actually holds the transaction; it isleft empty rather than guessed.
Recorded on every server path: gRPC
ExecuteQuery, gRPCExecuteNonQuery, RESTPOST /api/v1/query, RESTPOST /api/v1/execute, and theBeginTransactionFailedPreconditionbranch.Exposed as
GET /api/v1/management/activity—adminonly, because the payload names sessions, users and SQL text.Documented in
docs/server/REST_API.md› Management: live activity (with the exact JSON), listed indocs/FEATURE_MATRIX.md, recorded indocs/CHANGELOG.mdincluding the deliberate gaps.Tests:
ManagementActivityTests— 6 cases (entry for the whole scope, truncation, single-line flattening, conflictwith holder, bounded queue, empty-but-well-formed snapshot). Server suite 307/0; Sonar, coverage, codecov and the
three platform builds green on the PR.
What still keeps this open
DatabaseServiceoverride, the clientcall, and an entry in
GrpcCapabilityContract(whichGrpcCapabilityContractTestswould then enforce).deliberately lossy.
(Server transactions are stubs: Begin/Commit/Rollback accept the call but every statement autocommits #560), so a "lock wait" is a transaction conflict; there is no queue to report and this does not invent one. If
per-session transactions land (Per-session transaction isolation: two sessions cannot hold independent transactions (storage is single-transaction) #564), this is the place that has to grow a real wait list.
Where the docs changed with it
docs/server/REST_API.md(new section + payload),docs/FEATURE_MATRIX.md(row),docs/CHANGELOG.md(Added +Not in this slice). No gRPC contract change was made, so
docs/server/GRPC_CAPABILITY_MATRIX.mdneeded no edit — and that is stated in the REST section so nobody goes looking for an RPC that does not exist.