Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API bundles shared HTTP handler dependencies.
func NewAPI ¶
func NewAPI( authToken string, service CheckInService, registry *metrics.Registry, responseDetails bool, version, commit string, logger *slog.Logger, ) *API
NewAPI builds an API container with shared handler dependencies.
func (*API) CheckIn ¶
func (a *API) CheckIn() http.HandlerFunc
CheckIn returns the check-in endpoint handler.
func (*API) Healthz ¶
func (a *API) Healthz() http.HandlerFunc
Healthz returns a lightweight liveness endpoint.
func (*API) Readyz ¶ added in v0.0.11
func (a *API) Readyz() http.HandlerFunc
Readyz returns a lightweight readiness endpoint.
func (*API) Status ¶
func (a *API) Status() http.HandlerFunc
Status returns the current check-in monitor status endpoint handler.
func (*API) Version ¶
func (a *API) Version() http.HandlerFunc
Version returns the running build version and commit.
type CheckInService ¶
type CheckInService interface {
RecordCheckIn(ctx context.Context, at time.Time) service.RecordCheckInResult
Snapshot() service.SnapshotResult
}
CheckInService exposes the application behavior used by HTTP handler.
type RequestMetadata ¶
type RequestMetadata struct {
Remote string
ClientIP string
Method string
Path string
Host string
Proto string
UserAgent string
RequestID string
XForwardedFor string
XForwardedProto string
XForwardedHost string
XRealIP string
Forwarded string
}
RequestMetadata describes the request origin used for diagnostic logs.
Remote is the direct TCP peer that connected to this service. ClientIP is a best-effort value from proxy headers first, then from Remote. Do not use it for auth decisions unless your proxy chain sanitizes these headers.
func (RequestMetadata) LogFields ¶
func (m RequestMetadata) LogFields() []any
LogFields returns structured request-origin fields for logs.