Documentation
¶
Overview ¶
Package telemetry provides telemetry exporters for asyncmachine: am-dbg, Prometheus, and OpenTelemetry.
Index ¶
- Constants
- func BindLokiLogger(mach am.Api, client promtail.Client)
- func BindOtelLogger(mach am.Api, provider *ologsdk.LoggerProvider, service string)
- func NewOtelLoggerProvider(exporter ologsdk.Exporter) *ologsdk.LoggerProvider
- func NormalizeId(id string) string
- func TransitionsToDbg(mach am.Api, addr string) error
- type DbgMsg
- type DbgMsgStruct
- type DbgMsgTx
- func (d *DbgMsgTx) ActiveStates(statesIndex am.S) am.S
- func (d *DbgMsgTx) CalledStateNames(statesIndex am.S) am.S
- func (d *DbgMsgTx) Clock(statesIndex am.S, state string) uint64
- func (d *DbgMsgTx) Index(statesIndex am.S, state string) int
- func (d *DbgMsgTx) Is(statesIndex am.S, states am.S) bool
- func (d *DbgMsgTx) Is1(statesIndex am.S, state string) bool
- func (d *DbgMsgTx) String(statesIndex am.S) string
- func (d *DbgMsgTx) TimeSum() uint64
- type DbgTracer
- type OtelMachTracer
- func (ot *OtelMachTracer) End()
- func (ot *OtelMachTracer) HandlerEnd(tx *am.Transition, _ string, _ string)
- func (ot *OtelMachTracer) HandlerStart(tx *am.Transition, emitter string, handler string)
- func (ot *OtelMachTracer) Inheritable() bool
- func (ot *OtelMachTracer) MachineDispose(id string)
- func (ot *OtelMachTracer) MachineInit(mach *am.Machine) context.Context
- func (ot *OtelMachTracer) NewSubmachine(parent, mach *am.Machine)
- func (ot *OtelMachTracer) QueueEnd(*am.Machine)
- func (ot *OtelMachTracer) TransitionEnd(tx *am.Transition)
- func (ot *OtelMachTracer) TransitionInit(tx *am.Transition)
- type OtelMachTracerOpts
- type OtelMachineData
Constants ¶
const ( // DbgAddr is the default address of the am-dbg server. DbgAddr = "localhost:6831" // EnvAmDbgAddr set the address of a running am-dbg instance. // "localhost:6831" | "" (default) EnvAmDbgAddr = "AM_DBG_ADDR" )
Variables ¶
This section is empty.
Functions ¶
func BindOtelLogger ¶ added in v0.8.0
func BindOtelLogger( mach am.Api, provider *ologsdk.LoggerProvider, service string, )
BindOtelLogger binds an OpenTelemetry logger to a machine.
func NewOtelLoggerProvider ¶ added in v0.8.0
func NewOtelLoggerProvider(exporter ologsdk.Exporter) *ologsdk.LoggerProvider
NewOtelLoggerProvider creates a new OpenTelemetry logger provider bound to the given exporter.
func NormalizeId ¶ added in v0.8.0
Types ¶
type DbgMsg ¶ added in v0.5.0
type DbgMsg interface {
// Clock returns the state's clock, using the passed index
Clock(statesIndex am.S, state string) uint64
// Is returns true if the state is active, using the passed index
Is(statesIndex am.S, states am.S) bool
}
DbgMsg is the interface for the messages to be sent to the am-dbg server.
type DbgMsgStruct ¶ added in v0.5.0
type DbgMsgStruct struct {
// Machine ID
ID string
// state names defining the indexes for diffs
StatesIndex am.S
// all the states with relations
States am.Struct
// parent machine ID
Parent string
// machine tags
Tags []string
}
DbgMsgStruct contains the state and relations data.
type DbgMsgTx ¶ added in v0.5.0
type DbgMsgTx struct {
MachineID string
// Transition ID
ID string
// Clocks is [am.TimeAfter], state indexes to tick values after this tx
// TODO refac to TimeAfter, re-gen all the assets
Clocks am.Time
// result of the transition
Accepted bool
// mutation type
Type am.MutationType
// called states
// TODO index optimization
CalledStates []string
// TODO rename to CalledStates, re-gen all assets
CalledStatesIdxs []int
// all the transition steps
Steps []*am.Step
// log entries created during the transition
LogEntries []*am.LogEntry
// log entries before the transition, which happened after the prev one
PreLogEntries []*am.LogEntry
// transition was triggered by an auto state
IsAuto bool
// queue length at the start of the transition
Queue int
// TODO include missed mutations because of the queue limit
// since the previous tx
// Time is human time. Don't send this over the wire.
// TODO remove, re-gen all the assets
Time *time.Time
}
DbgMsgTx contains transition data.
func (*DbgMsgTx) ActiveStates ¶ added in v0.8.0
func (*DbgMsgTx) CalledStateNames ¶ added in v0.8.0
type DbgTracer ¶ added in v0.7.0
type DbgTracer struct {
*am.NoOpTracer
Addr string
Mach am.Api
// contains filtered or unexported fields
}
func (*DbgTracer) MachineDispose ¶ added in v0.8.0
func (*DbgTracer) MachineInit ¶ added in v0.8.0
func (*DbgTracer) StructChange ¶ added in v0.7.0
func (*DbgTracer) TransitionEnd ¶ added in v0.7.0
func (t *DbgTracer) TransitionEnd(tx *am.Transition)
type OtelMachTracer ¶ added in v0.5.0
type OtelMachTracer struct {
Tracer trace.Tracer
Machines map[string]*OtelMachineData
MachinesMx sync.Mutex
MachinesOrder []string
// TODO bind to env var
Logf func(format string, args ...any)
// contains filtered or unexported fields
}
OtelMachTracer implements machine.Tracer for OpenTelemetry. Support tracing of multiple state machines.
func NewOtelMachTracer ¶ added in v0.5.0
func NewOtelMachTracer(tracer trace.Tracer, opts *OtelMachTracerOpts, ) *OtelMachTracer
NewOtelMachTracer creates a new machine tracer from an OpenTelemetry tracer. Requires OtelMachTracer.Dispose to be called at the end.
func (*OtelMachTracer) End ¶ added in v0.5.0
func (ot *OtelMachTracer) End()
func (*OtelMachTracer) HandlerEnd ¶ added in v0.5.0
func (ot *OtelMachTracer) HandlerEnd(tx *am.Transition, _ string, _ string)
func (*OtelMachTracer) HandlerStart ¶ added in v0.5.0
func (ot *OtelMachTracer) HandlerStart( tx *am.Transition, emitter string, handler string, )
func (*OtelMachTracer) Inheritable ¶ added in v0.5.0
func (ot *OtelMachTracer) Inheritable() bool
func (*OtelMachTracer) MachineDispose ¶ added in v0.5.0
func (ot *OtelMachTracer) MachineDispose(id string)
func (*OtelMachTracer) MachineInit ¶ added in v0.5.0
func (ot *OtelMachTracer) MachineInit(mach *am.Machine) context.Context
func (*OtelMachTracer) NewSubmachine ¶ added in v0.5.0
func (ot *OtelMachTracer) NewSubmachine(parent, mach *am.Machine)
NewSubmachine links 2 machines with a parent-child relationship.
func (*OtelMachTracer) QueueEnd ¶ added in v0.6.0
func (ot *OtelMachTracer) QueueEnd(*am.Machine)
func (*OtelMachTracer) TransitionEnd ¶ added in v0.5.0
func (ot *OtelMachTracer) TransitionEnd(tx *am.Transition)
func (*OtelMachTracer) TransitionInit ¶ added in v0.5.0
func (ot *OtelMachTracer) TransitionInit(tx *am.Transition)
type OtelMachTracerOpts ¶ added in v0.5.0
Directories
¶
| Path | Synopsis |
|---|---|
|
Package prometheus provides Prometheus metrics for asyncmachine.
|
Package prometheus provides Prometheus metrics for asyncmachine. |

