hoststate

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hoststate tracks ManagedService lifecycle state without depending on OpenTelemetry or any other third-party package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Count

type Count struct {
	Module  string
	Service string
	State   State
	Count   int64
}

Count is an aggregate snapshot row for one module, service, and state.

func Snapshot

func Snapshot() []Count

Snapshot returns a stable copy of all positive process-wide state counts.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the stdlib-only bridge between one Host-managed service and the process-wide aggregate. Its identity is never included in metric labels.

func NewService

func NewService(module, name string) *Service

NewService registers one ManagedService instance in the created state.

func (*Service) Transition

func (s *Service) Transition(next State)

Transition changes this instance's state once. Failed is sticky so cleanup attempts cannot hide the phase that caused the Host to roll back.

type State

type State string

State is a finite ManagedService lifecycle state.

const (
	StateCreated    State = "created"
	StateStarting   State = "starting"
	StateRunning    State = "running"
	StateReady      State = "ready"
	StateFailed     State = "failed"
	StateDraining   State = "draining"
	StateStopping   State = "stopping"
	StateStopped    State = "stopped"
	StateNotStarted State = "not_started"
)

ManagedService lifecycle states. Their values are metric label values, so additions must remain finite and must not contain instance-specific data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL