diagnostics

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: AGPL-3.0, AGPL-3.0 Imports: 11 Imported by: 1 module, 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 diagnostics carries source-owned execution evidence independently of application state. Adding an event never requires a consumer-side vocabulary.

Index

Constants

View Source
const MaximumTextBytes = 16 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields map[string]Value

type Record

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

Record is immutable after construction. A sink adds ownership without interpreting the event's payload or replacing its source timestamp.

func New

func New(name string, fields Fields) Record

func (Record) At

func (record Record) At(at time.Time) Record

func (Record) Correlate

func (record Record) Correlate(fields Fields) Record

func (Record) Correlation

func (record Record) Correlation() Value

func (Record) Name

func (record Record) Name() string

func (Record) ObservedAt

func (record Record) ObservedAt() time.Time

func (Record) Payload

func (record Record) Payload() Value

func (Record) Scope

func (record Record) Scope() Scope

func (Record) Valid

func (record Record) Valid() bool

func (Record) With

func (record Record) With(fields Fields) Record

With adds owning-context facts to a detached copy.

type Scope

type Scope struct {
	EngineID string `json:"engine_id,omitempty"`
	TaskID   string `json:"engine_task_id,omitempty"`
	Workflow string `json:"workflow,omitempty"`
}

type Sink

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

Sink is an injected, nonblocking publication capability. It cannot execute consumer code on a protocol or transfer goroutine. Its zero value is disabled.

func (Sink) Bind

func (sink Sink) Bind(scope Scope) Sink

func (Sink) Emit

func (sink Sink) Emit(record Record) bool

func (Sink) Enabled

func (sink Sink) Enabled() bool

func (Sink) Lost

func (sink Sink) Lost(source string, count uint64)

Lost transfers an upstream producer's final loss delta to recorder health. Call once per producer completion, never for repeated cumulative snapshots.

func (Sink) Record

func (sink Sink) Record(source Source) bool

type Source

type Source interface{ DiagnosticRecord() Record }

Source owns its event name and detached attributes. Disabled sinks never ask it to encode, keeping diagnostics off the ordinary transfer allocation path.

type Stream

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

func NewStream

func NewStream(capacity observationstream.Capacity, now func() time.Time) (*Stream, error)

func (*Stream) Capture added in v0.1.5

func (stream *Stream) Capture() (Sink, func())

Capture gives one recording interval its own revocable sink. Stopping it leaves already queued records available and never reactivates old producers when another capture starts on the shared stream.

func (*Stream) Close

func (stream *Stream) Close() observationstream.Completion

Close belongs to the host, after its engines stop. One task cannot close a shared recorder or wait for a detached consumer.

func (*Stream) Controlled added in v0.1.5

func (stream *Stream) Controlled(enabled bool) (Sink, func(bool))

Controlled returns a sink whose publication follows set(enabled). Use Capture for task-scoped intervals that must never reactivate after stopping.

func (*Stream) Records

func (stream *Stream) Records() <-chan Record

func (*Stream) Sink

func (stream *Stream) Sink() Sink

type Value

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

Value admits only detached JSON values. Native objects, callbacks and errors cannot escape into a recorder or retain a connection through its queue.

func Array

func Array(values ...Value) Value

func Bool

func Bool(value bool) Value

func Failure

func Failure(snapshot diagnosticerror.Snapshot) Value

func Hex

func Hex(value []byte) Value

func Identity

func Identity(value []byte) Value

func Int

func Int(value int64) Value

func Millis

func Millis(value time.Duration) Value

func Number

func Number(value float64) Value

Nonfinite measurements retain their diagnostic spelling instead of rejecting the record.

func Object

func Object(fields Fields) Value

func Text

func Text(value string) Value

func Uint

func Uint(value uint64) Value

Counters use decimal strings so JSON consumers retain all 64 bits.

func (Value) Bool

func (value Value) Bool() bool

func (Value) Get

func (value Value) Get(key string) Value

func (Value) MarshalJSON

func (value Value) MarshalJSON() ([]byte, error)

func (Value) Present

func (value Value) Present() bool

func (Value) Text

func (value Value) Text() string

func (Value) Uint

func (value Value) Uint() uint64

Jump to

Keyboard shortcuts

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