mock

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	Mu            sync.Mutex
	Signals       []string
	Restarts      map[string]int // Supervisor -> count
	ChildRestarts map[string]int // Child -> count
	Backoffs      map[string]time.Duration

	// Additional counters for verification
	SupervisorAdds         map[string]int
	SupervisorRemoves      map[string]int
	WorkerStarts           map[string]int
	WorkerStops            map[string]int
	WorkerFails            map[string]int
	CircuitBreakerTriggers map[string]int

	// Goroutine metrics
	GoroutinesStarted  int
	GoroutinesFinished int
	GoroutinesPanicked int
	GoroutinesWaiting  int

	// Control Plane metrics
	EventsEmitted    map[string]int
	EventsRouted     map[string]int
	HandlersExecuted map[string]int
	HandlerErrors    map[string]int
	HandlerDurations map[string]time.Duration

	// Critical Section metrics
	CriticalSectionStarted   int
	CriticalSectionFinished  int
	CriticalSectionSuccesses int
	CriticalSectionFailures  int
	CriticalSectionDuration  time.Duration

	EventBlockDurations map[string]time.Duration
	EventsWaiting       map[string]int
}

Provider matches metrics.Provider interface for testing. It is safe for concurrent use.

func New

func New() *Provider

func (*Provider) DecEventWaiting

func (m *Provider) DecEventWaiting(source string)

func (*Provider) DecGoroutineWaiting

func (m *Provider) DecGoroutineWaiting()

func (*Provider) IncBackoffTriggered

func (m *Provider) IncBackoffTriggered(c string, d time.Duration)

func (*Provider) IncChildRestart

func (m *Provider) IncChildRestart(s, c string)

func (*Provider) IncCircuitBreakerTriggered

func (m *Provider) IncCircuitBreakerTriggered(c string)

func (*Provider) IncContainerFailed

func (m *Provider) IncContainerFailed(image string)

func (*Provider) IncContainerStarted

func (m *Provider) IncContainerStarted(image string)

func (*Provider) IncContainerStopped

func (m *Provider) IncContainerStopped(image string)

func (*Provider) IncCriticalSectionFinished

func (m *Provider) IncCriticalSectionFinished(success bool)

func (*Provider) IncCriticalSectionStarted

func (m *Provider) IncCriticalSectionStarted()

func (*Provider) IncEventEmitted

func (m *Provider) IncEventEmitted(source string)

func (*Provider) IncEventRouted

func (m *Provider) IncEventRouted(topic string)

func (*Provider) IncEventWaiting

func (m *Provider) IncEventWaiting(source string)

func (*Provider) IncForceExitTriggered

func (m *Provider) IncForceExitTriggered()

func (*Provider) IncGoroutineFinished

func (m *Provider) IncGoroutineFinished()

func (*Provider) IncGoroutinePanicked

func (m *Provider) IncGoroutinePanicked()

func (*Provider) IncGoroutineStarted

func (m *Provider) IncGoroutineStarted()

func (*Provider) IncGoroutineWaiting

func (m *Provider) IncGoroutineWaiting()

func (*Provider) IncHandlerError

func (m *Provider) IncHandlerError(topic string, err error)

func (*Provider) IncHandlerExecuted

func (m *Provider) IncHandlerExecuted(topic string)

func (*Provider) IncHookExecuted

func (m *Provider) IncHookExecuted()

func (*Provider) IncHookPanicked

func (m *Provider) IncHookPanicked()

func (*Provider) IncProcessFailed

func (m *Provider) IncProcessFailed()

func (*Provider) IncProcessStarted

func (m *Provider) IncProcessStarted()

func (*Provider) IncSignalReceived

func (m *Provider) IncSignalReceived(sig string)

func (*Provider) IncSupervisorAdd

func (m *Provider) IncSupervisorAdd(s string)

func (*Provider) IncSupervisorRemove

func (m *Provider) IncSupervisorRemove(s string)

func (*Provider) IncSupervisorRestart

func (m *Provider) IncSupervisorRestart(s, strategy string)

func (*Provider) IncTerminalUpgrade

func (m *Provider) IncTerminalUpgrade(success bool)

func (*Provider) IncWorkerFailed

func (m *Provider) IncWorkerFailed(wt string)

func (*Provider) IncWorkerStarted

func (m *Provider) IncWorkerStarted(wt string)

func (*Provider) IncWorkerStopped

func (m *Provider) IncWorkerStopped(wt string)

func (*Provider) ObserveContainerDuration

func (m *Provider) ObserveContainerDuration(image string, d time.Duration)

func (*Provider) ObserveCriticalSectionDuration

func (m *Provider) ObserveCriticalSectionDuration(d time.Duration)

func (*Provider) ObserveEventBlockDuration

func (m *Provider) ObserveEventBlockDuration(source string, d time.Duration)

func (*Provider) ObserveGoroutineBlockDuration

func (m *Provider) ObserveGoroutineBlockDuration(d time.Duration)

func (*Provider) ObserveHandlerDuration

func (m *Provider) ObserveHandlerDuration(topic string, d time.Duration)

func (*Provider) ObserveHookDuration

func (m *Provider) ObserveHookDuration(d time.Duration)

func (*Provider) ObserveShutdownDuration

func (m *Provider) ObserveShutdownDuration(wt string, d time.Duration)

func (*Provider) ObserveWorkerDuration

func (m *Provider) ObserveWorkerDuration(wt string, d time.Duration)

Jump to

Keyboard shortcuts

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