Shared DTOs and utility functions used by Alma.Status and Alma.Fable.Status libraries.
The package provides a single place for the status payload model so both sides can exchange the same data contract.
Add the package reference with Paket:
nuget Alma.Status.Common
or with the .NET CLI:
dotnet add package Alma.Status.Commonopen System
open Alma.ServiceIdentification
open Alma.Status.Common
let now = DateTimeOffset.UtcNow
let apiStatus =
Status.Warning {
DateTime = now
Message = Some "Response time is above threshold"
Note = Some "p95 latency is 1.8s"
}
let dbStatus =
Status.Normal {
DateTime = now
Message = Some "Connection pool is healthy"
Note = None
}
let items = [
StatusItem.System {
Name = "api"
Status = apiStatus
Tags = [ Tag "public"; TagKV ("region", "eu-west") ]
}
StatusItem.DataObject {
Name = "database"
Status = dbStatus
Details = [ Detail { Name = "connections"; Value = Number 12 } ]
Tags = [ Tag "postgres" ]
}
]
let overallStatus = items |> Status.foldItemsStatus.add, Status.fold, and Status.foldItems keep the highest severity found in the input while preserving the first message for that severity.
open System
open Alma.ServiceIdentification
open Alma.Status.Common
let statusItem =
StatusItem.Service {
Name = "worker"
Instance = Instance "worker-01"
Status =
Status.Info {
DateTime = DateTimeOffset.UtcNow
Message = Some "Deployment in progress"
Note = None
}
Tags = [ TagKV ("version", "2.3.0") ]
}
let itemName = statusItem.Name
let itemStatus = statusItem.Statusopen System
open Alma.Status.Common
let formatted =
DateTimeOffset.UtcNow
|> DateTimeOffset.pretty
printfn "%s" formattedThe DateTimeOffset.pretty helper formats timestamps as dd.MM.yyyy H:mm:ss.
Main DTOs exposed by the package:
StatusMessagefor timestamped status payloads with optional message and note.Statusfor severity levels:Normal,Info,Warning, andCritical.Tagfor plain tags and key-value tags.StatusItemforSystem,Service, andDataObjectstatus entries.History.IncidentHistoryfor incident history records.
- Increment the version in
src/Alma.Fable.Status.Common/Alma.Fable.Status.Common.fsproj. - Update
CHANGELOG.md. - Commit the change and create a version tag.
- Push the branch and tag so the publish workflow can release the package.
- .NET SDK
- Paket (
dotnet tool restorein this repository restores the required tools)
./build.sh build./build.sh -t tests./build.sh -t lint