Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncRecorder ¶ added in v0.22.0
type AsyncRecorder struct {
// contains filtered or unexported fields
}
AsyncRecorder records history events asynchronously.
func NewAsyncRecorder ¶ added in v0.22.0
func NewAsyncRecorder(recorder Recorder, logger *slog.Logger, buffer int) *AsyncRecorder
NewAsyncRecorder wraps a Recorder with a buffered async queue.
func (*AsyncRecorder) Add ¶ added in v0.22.0
func (a *AsyncRecorder) Add(e Event)
Add enqueues an event without blocking.
func (*AsyncRecorder) List ¶ added in v0.22.0
func (a *AsyncRecorder) List() []Event
List returns a snapshot of recorded events.
func (*AsyncRecorder) ListByID ¶ added in v0.22.0
func (a *AsyncRecorder) ListByID(heartbeatID string) []Event
ListByID returns recorded events filtered by heartbeat id.
func (*AsyncRecorder) Start ¶ added in v0.22.0
func (a *AsyncRecorder) Start(ctx context.Context)
Start begins draining the async queue until ctx is canceled.
func (*AsyncRecorder) Subscribe ¶ added in v0.22.0
func (a *AsyncRecorder) Subscribe(buffer int) (<-chan Event, func())
Subscribe registers a buffered event stream.
type Event ¶
type Event struct {
Time time.Time `json:"timestamp"` // Event timestamp.
Type string `json:"type"` // Event type identifier.
HeartbeatID string `json:"heartbeatId,omitempty"` // Heartbeat id.
Receiver string `json:"receiver,omitempty"` // Receiver name.
TargetType string `json:"targetType,omitempty"` // Delivery target type.
Status string `json:"status,omitempty"` // Status value.
Message string `json:"message,omitempty"` // Human-readable message.
Fields map[string]any `json:"fields,omitempty"` // Optional fields.
}
Event represents a recorded history item.
Click to show internal directories.
Click to hide internal directories.