Documentation
¶
Overview ¶
Package diagnostics carries source-owned execution evidence independently of application state. Adding an event never requires a consumer-side vocabulary.
Index ¶
- Constants
- Variables
- func EncodeIdentity(raw []byte) string
- type CorrelationInput
- type CorrelationV1
- type Fields
- type LaneCorrelation
- type Record
- func (record Record) At(at time.Time) Record
- func (record Record) Correlate(fields Fields) Record
- func (record Record) Correlation() Value
- func (record Record) Name() string
- func (record Record) ObservedAt() time.Time
- func (record Record) Payload() Value
- func (record Record) Scope() Scope
- func (record Record) Valid() bool
- func (record Record) With(fields Fields) Record
- type Scope
- type Sink
- type Source
- type Stream
- type Value
- func Array(values ...Value) Value
- func Bool(value bool) Value
- func Failure(snapshot diagnosticerror.Snapshot) Value
- func Hex(value []byte) Value
- func Identity(value []byte) Value
- func Int(value int64) Value
- func Millis(value time.Duration) Value
- func Number(value float64) Value
- func Object(fields Fields) Value
- func Text(value string) Value
- func Uint(value uint64) Value
Constants ¶
const IdentityBytes = 16
const MaximumTextBytes = 16 * 1024
Variables ¶
var ErrInvalidCorrelation = errors.New("diagnostic correlation is invalid")
Functions ¶
func EncodeIdentity ¶ added in v0.1.6
Types ¶
type CorrelationInput ¶ added in v0.1.6
type CorrelationInput struct {
ProtocolSessionID []byte
ProtocolOperationID uint64
PeerPathID []byte
PeerAttemptID []byte
Lane *LaneCorrelation
}
CorrelationInput carries raw protocol/path identities prior to JSON projection. Empty or all-zero slices (and zero ProtocolOperationID) represent absent identities.
type CorrelationV1 ¶ added in v0.1.6
type CorrelationV1 struct {
ProtocolSessionID string `json:"protocol_session_id,omitempty"`
ProtocolOperationID string `json:"protocol_operation_id,omitempty"`
PeerPathID string `json:"peer_path_id,omitempty"`
PeerAttemptID string `json:"peer_attempt_id,omitempty"`
LaneID *uint32 `json:"lane_id,omitempty"`
LaneEpoch *uint32 `json:"lane_epoch,omitempty"`
}
CorrelationV1 is the cross-runtime JSON projection shared with browser diagnostics. Runtime-local and output identities intentionally do not fit.
func ProjectCorrelationV1 ¶ added in v0.1.6
func ProjectCorrelationV1(input CorrelationInput) (*CorrelationV1, error)
ProjectCorrelationV1 converts 16-byte identities into canonical unpadded base64url and monotonic operation IDs into canonical decimal uint64 text at the JSON boundary. A nil result represents local-only work.
type LaneCorrelation ¶ added in v0.1.6
LaneCorrelation uses explicit pointer presence because zero is a valid uint32 lane value and therefore cannot double as an absence sentinel.
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 (Record) Correlation ¶
func (Record) ObservedAt ¶
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.
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 (*Stream) Capture ¶ added in v0.1.5
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
Controlled returns a sink whose publication follows set(enabled). Use Capture for task-scoped intervals that must never reactivate after stopping.
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 Failure ¶
func Failure(snapshot diagnosticerror.Snapshot) Value
func Number ¶
Nonfinite measurements retain their diagnostic spelling instead of rejecting the record.