Documentation
¶
Overview ¶
Package diagnostic declares application diagnostics over explicit observations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventView ¶
type EventView struct {
// ReceivedAt is when capture received the event; the wire name stays time.
ReceivedAt time.Time `json:"time"`
// Age is human-readable time since receipt.
Age string `json:"age"`
// Name identifies the event topic.
Name string `json:"name"`
// PayloadType identifies the Go payload type without retaining its value.
PayloadType string `json:"payload_type"`
// TraceID correlates dispatch with a span, when one was present.
TraceID string `json:"trace_id,omitzero"`
}
EventView retains metadata only. Payload values never enter capture memory.
type HealthCheckView ¶
type HealthCheckView struct {
// Name identifies the registered check.
Name string `json:"name"`
// Status is ok or failing.
Status string `json:"status"`
// Error is safe diagnostic failure text, absent on success.
Error string `json:"error,omitzero"`
// Since is when the last status transition occurred.
Since time.Time `json:"since,omitzero"`
// CheckedAt is when the check last completed.
CheckedAt time.Time `json:"checked_at,omitzero"`
// Age formats the age of CheckedAt.
Age string `json:"age,omitzero"`
}
HealthCheckView is an intentionally diagnostic check report. Failure text is withheld unless the app explicitly enabled HealthDetails.
type HealthReport ¶
type HealthReport struct {
// Status is ok, pending, failing, or stale for an expired cached pass.
Status string `json:"status"`
// Items contains checks in registration order, never null.
Items []HealthCheckView `json:"items"`
}
HealthReport is the cached or explicitly refreshed check report.
type HealthyView ¶
type HealthyView struct {
// Status is ok, pending, failing, or stale.
Status string `json:"status"`
// CheckedAt is the last completed background pass.
CheckedAt time.Time `json:"checked_at,omitzero"`
// Checks contains safe check results in registration order, never null.
Checks []HealthCheckView `json:"checks"`
}
HealthyView observes background health without running dependency checks.
type Owner ¶
type Owner struct {
// State observes the current execution phase.
State func() string
// Started observes successful startup even after shutdown.
Started func() StartedView
// Ready shares the HTTP probe's readiness evaluation.
Ready func() ReadyView
// Health owns the check registry and cached background passes.
Health *health.Monitor
// Details explicitly permits diagnostic failure text.
Details bool
}
Owner supplies application observations without importing the public package.
func (*Owner) HealthyView ¶
func (owner *Owner) HealthyView() HealthyView
HealthyView distinguishes absent checks from an uncompleted first pass and applies the same error-disclosure policy as explicit diagnostics.
type ReadyView ¶
type ReadyView struct {
// Ready reports whether traffic may be accepted.
Ready bool `json:"ready"`
// Reason explains an unsatisfied condition without dependency error text.
Reason string `json:"reason,omitzero"`
}
ReadyView agrees with the owner's readiness probe.
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring retains bounded metadata and atomically pairs each snapshot with its high-water mark and notification channel.
type StartedView ¶
type StartedView struct {
// Started reports successful startup completion.
Started bool `json:"started"`
// State reports the current lifecycle phase.
State string `json:"state"`
// StartedAt is absent before startup completes.
StartedAt time.Time `json:"started_at,omitzero"`
}
StartedView retains successful startup even after the app stops.