Class WorkLeaseTelemetry
- Namespace
- MailFathom.Infrastructure.Observability
- Assembly
- MailFathom.Infrastructure.dll
Makes exclusive hold of work legible from outside the process: what this replica holds, and how often a scope changed hands.
public sealed class WorkLeaseTelemetry
- Inheritance
-
WorkLeaseTelemetry
- Inherited Members
Remarks
Three instruments, and each answers a question the others cannot. The gauge says which scopes this replica is holding right now, which is how "who holds what" is read across a deployment — the replica is named by the resource attributes every measurement it publishes already carries, so one series per scope per replica answers it without the holder identity ever becoming a dimension. The claims say how often a scope changed hands, which is the signal that work is moving between replicas rather than sitting where it started; a granted claim is by construction a change of holder, because a live lease is refused whoever asks for it. And the renewals say when a holder lost a scope it thought it had, which is the one thing that stops work: a refused renewal is a replica cancelling a run, and it would otherwise be invisible from outside.
A release is deliberately not a fourth instrument. What it does is drop the scope out of the gauge, which is the same reading a refused renewal produces, and both are what an operator watching a rolling upgrade wants to see.
Nothing published here is mail or derived from it. The one dimension is the scope, which is composed of MailFathom's own names — an account alias, a user identity, the name of a walk — and is bounded by how much singleton work the deployment configures. The holder is off every measurement, because it is a fresh identity per hold and would make a new series of every takeover; an operator who needs it reads the lease table, which is where it is kept.
Constructors
- WorkLeaseTelemetry()
Initializes the instruments every claim, renewal, and release reports through.
Methods
- RecordClaim(WorkScope, bool)
Records an attempt to take a scope, and starts publishing the scope when the attempt took it.
- RecordRelease(WorkScope)
Stops publishing a scope this replica has given back.
- RecordRenewal(WorkScope, bool)
Records an attempt to extend a lease, and stops publishing the scope when the holder had lost it.