Documentation
¶
Overview ¶
Package serverdiag is the server's bounded, value-free stderr boundary.
Index ¶
- func BackgroundCallback(work func()) func()
- func BackgroundErrorCallback(work func() error) func() error
- func CanonicalRoute(route string) string
- func DrainBy(deadline time.Time)
- func Emit(e Event)
- func ErrorLog() *log.Logger
- func ProcessStartedAt() string
- func RegisterBackgroundDrain(drain func(context.Context)) func()
- func RegisterRoutes(routes ...string)
- func Shutdown(ctx context.Context)
- func StartBackground(policy BackgroundPolicy, stop <-chan struct{}, work, finished func())
- func Use(s *Sink) func()
- type BackgroundPolicy
- type Event
- type Frame
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackgroundCallback ¶ added in v1.2.0
func BackgroundCallback(work func()) func()
BackgroundCallback guards a one-shot callback launched by another API.
func BackgroundErrorCallback ¶ added in v1.2.0
BackgroundErrorCallback preserves ordinary errors for errgroup-style APIs.
func CanonicalRoute ¶ added in v1.2.0
func ProcessStartedAt ¶ added in v1.2.0
func ProcessStartedAt() string
func RegisterBackgroundDrain ¶ added in v1.2.0
RegisterBackgroundDrain avoids a dependency from diagnostics to the file logger.
func RegisterRoutes ¶
func RegisterRoutes(routes ...string)
RegisterRoutes is called with the static dispatch inventory during package init.
func StartBackground ¶ added in v1.2.0
func StartBackground(policy BackgroundPolicy, stop <-chan struct{}, work, finished func())
StartBackground owns the panic boundary and completion callback. Restart is only for idempotent work; finished runs once, after all restart attempts.
Types ¶
type BackgroundPolicy ¶ added in v1.2.0
type BackgroundPolicy uint8
const ( BackgroundStop BackgroundPolicy = iota BackgroundRestart )
type Event ¶
type Event struct {
RestartCount uint64 `json:"restart_count,omitempty"`
AccessLogEnabled *bool `json:"access_log_enabled,omitempty"`
MaxSizeBytes int64 `json:"max_size_bytes,omitempty"`
MaxFiles int `json:"max_files,omitempty"`
MaxAgeDays int `json:"max_age_days,omitempty"`
AccessDropped uint64 `json:"dropped_total,omitempty"`
WriteErrors uint64 `json:"write_errors_total,omitempty"`
RotationErrors uint64 `json:"rotation_errors_total,omitempty"`
PruneErrors uint64 `json:"prune_errors_total,omitempty"`
Reopens uint64 `json:"reopens_total,omitempty"`
Bind string `json:"bind,omitempty"`
Detail string `json:"detail,omitempty"`
Flag string `json:"flag,omitempty"`
ForwardedHint bool `json:"-"`
Status string `json:"status,omitempty"`
Message string `json:"message,omitempty"`
Type string `json:"type"`
Reason string `json:"reason,omitempty"`
Route string `json:"route,omitempty"`
Peer string `json:"peer,omitempty"`
Count uint64 `json:"count,omitempty"`
Targets int `json:"targets,omitempty"`
Accepted int `json:"accepted,omitempty"`
Failed int `json:"failed,omitempty"`
Bytes int64 `json:"bytes,omitempty"`
PanicType string `json:"panic_type,omitempty"`
Stack []Frame `json:"stack,omitempty"`
ProcessStartedAt string `json:"process_started_at"`
DroppedTotal uint64 `json:"diagnostics_dropped_total"`
}
Event contains only classified fields; it never holds requests or errors. Route must already be a registered constant template (controlpanel.AccessRoute).