runtime

package
v0.0.0-...-c124da1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package runtime captures low-cardinality runtime diagnostics for gofly transports and governance components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentSnapshot

type ComponentSnapshot struct {
	Name       string              `json:"name"`
	Kind       string              `json:"kind"`
	Owner      string              `json:"owner,omitempty"`
	Target     string              `json:"target,omitempty"`
	Status     string              `json:"status,omitempty"`
	Error      string              `json:"error,omitempty"`
	Middleware *MiddlewareSnapshot `json:"middleware,omitempty"`
	Governance any                 `json:"governance,omitempty"`
	Resolver   any                 `json:"resolver,omitempty"`
	Balancer   any                 `json:"balancer,omitempty"`
	ConnPool   any                 `json:"connPool,omitempty"`
	Retry      any                 `json:"retry,omitempty"`
	Breaker    any                 `json:"breaker,omitempty"`
	Details    any                 `json:"details,omitempty"`
}

ComponentSnapshot captures one runtime component's diagnostic state.

type DumpFunc

type DumpFunc func(context.Context) ComponentSnapshot

DumpFunc returns a component runtime snapshot.

type MiddlewareLayer

type MiddlewareLayer struct {
	Name   string `json:"name"`
	Source string `json:"source,omitempty"`
	Order  int    `json:"order"`
	Reason string `json:"reason,omitempty"`
}

MiddlewareLayer identifies one resolved middleware layer.

type MiddlewareSnapshot

type MiddlewareSnapshot struct {
	Unary  []MiddlewareLayer `json:"unary,omitempty"`
	Stream []MiddlewareLayer `json:"stream,omitempty"`
}

MiddlewareSnapshot captures the final middleware or interceptor chain.

type Option

type Option func(*component)

Option customises a registered runtime component.

func WithOwner

func WithOwner(owner string) Option

WithOwner records the owning subsystem, such as rest, rpc, or governance.

func WithTarget

func WithTarget(target string) Option

WithTarget records the component target, such as a route, service, or endpoint.

type Registry

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

Registry collects runtime component snapshots.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty runtime registry.

func (*Registry) Register

func (r *Registry) Register(name, kind string, dump DumpFunc, opts ...Option)

Register adds a component dump function to the registry.

func (*Registry) Snapshot

func (r *Registry) Snapshot(ctx context.Context) Snapshot

Snapshot returns a deterministic snapshot of all registered components.

type Snapshot

type Snapshot struct {
	GeneratedAt time.Time           `json:"generatedAt"`
	Components  []ComponentSnapshot `json:"components,omitempty"`
}

Snapshot captures the current runtime state of registered components.

Jump to

Keyboard shortcuts

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