Table of Contents

Class PlatformHealthController

Namespace
FishMMO.ControlPanel.Controllers
Assembly
FishMMO-ControlPanel.dll

The panel's own health, and the shared infrastructure it sits on.

[ApiController]
[Route("api/platform/health")]
public sealed class PlatformHealthController : ControllerBase
Inheritance
PlatformHealthController
Inherited Members

Remarks

What this page is for, and what it deliberately is not. Three other screens already answer "is the shard up": the server board owns game server processes, their pulse and their population; daemon hosts owns supervised OS processes and the daemons watching them; the queues page owns email queue depth. Repeating any of those here would produce a second number for the same fact, and two screens that disagree by one poll interval is worse than one screen. What is left over — and what nothing else in the panel can tell you — is the state of this process and of the database every other page reads through. That is all this endpoint returns.

The pool figures belong to this process alone. ConnectionPoolMetrics is a field on the singleton factory this host built at startup, fed by an EF connection interceptor. It counts connections the Control Panel opened. Each game server runs its own pool against the same PostgreSQL and is invisible here, and so is PostgreSQL's own max_connections ceiling. Saying "the pool" without saying whose would invite an operator to read a healthy panel as a healthy shard.

No secret, connection string or password can leave this endpoint. That is enforced by what is fetched, not by care at the point of serialization. This controller never takes a dependency on NpgsqlDbConfiguration, which is the only type here that holds a connection string. Two diagnostic strings that could carry credential material — the driver's own connect-failure message from TryConnectAsync, and the exception text behind an unavailable schema check — are deliberately not projected at all: they are arbitrary exception text from a database driver, and no amount of reading them today guarantees what a future Npgsql release puts in one. Both are written to the application log instead, and the payload says so, so an operator knows the detail exists and where it is rather than believing there was none. Every other string sent from here is either a literal authored in this repository or a name from a closed set (a migration identifier, a {Service}.{Method} operation name, an audit action id).

Reads here are not audited. Glancing at a health page is not an operator action, and a page polled every ten seconds by every open tab would write more audit rows than every real action combined — burying the log this same endpoint reports on. It is gated at Operator and logged to the application log, exactly as the audit log's own reader is.

This endpoint measures by acting. The round trip is a real connection, so the page contributes to the very counters below it: each poll adds one to connections opened and closed. That is worth the honesty of a latency figure that was actually observed rather than one cached from somebody else's query.

Constructors

PlatformHealthController(NpgsqlDbContextFactory, IAdminAuditService, TotpKeyProvider, PanelRegistrationOptions, IWebHostEnvironment, ILogger<PlatformHealthController>)

public PlatformHealthController(NpgsqlDbContextFactory factory, IAdminAuditService audit, TotpKeyProvider totpKeys, PanelRegistrationOptions registration, IWebHostEnvironment environment, ILogger<PlatformHealthController> log)

Parameters

factory NpgsqlDbContextFactory
audit IAdminAuditService
totpKeys TotpKeyProvider
registration PanelRegistrationOptions
environment IWebHostEnvironment
log ILogger<PlatformHealthController>

Methods

Get()

Everything the page shows, in one read.

[HttpGet]
[Authorize(Policy = "Operator")]
public Task<IActionResult> Get()

Returns

Task<IActionResult>

Remarks

Deliberately one endpoint rather than four. Each section answers a different question, but they are read together to decide one thing — whether the panel is healthy — and a page assembled from four independently timed reads shows four different instants.