Documentation
¶
Overview ¶
Package recorder captures bounded application-layer observations and commits only sanitized payloads to the evidence CAS.
Index ¶
Constants ¶
const DefaultMaxObservationBytes = 1 << 20
const DefaultMaxSSEBufferBytes = 1 << 20
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
RunID schema.InstanceID
InvocationID schema.InstanceID
AttemptID schema.InstanceID
Producer schema.Producer
CaptureLayer schema.CaptureLayer
InstrumentationMode schema.InstrumentationMode
MaxObservationBytes int
Now func() time.Time
}
Config freezes the observation point for a recorder. A caller cannot change capture layer or instrumentation mode on individual observations.
type Observation ¶
type Observation struct {
Sequence uint64
CaptureLayer schema.CaptureLayer
InstrumentationMode schema.InstrumentationMode
Direction schema.Direction
Kind string
MonotonicOffsetNS int64
ByteOffset *int64
EventOffset *int64
Payload []byte
Format PayloadFormat
Relations []schema.EvidenceRelation
}
Observation is source-faithful only at its declared application capture layer. Payload remains in memory until redaction succeeds.
type PayloadFormat ¶
type PayloadFormat string
const ( PayloadText PayloadFormat = "text" PayloadJSON PayloadFormat = "json" )
type ReadChunk ¶
ReadChunk is one transport read at an explicitly declared application capture layer. Its boundary is not an SSE logical-event boundary.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
func (*Recorder) Record ¶
func (recorder *Recorder) Record(ctx context.Context, observation Observation) (schema.Evidence, error)
Record sanitizes an in-memory observation, commits the sanitized bytes to CAS, constructs digest-bound evidence, and persists that typed envelope. Sequence advances only after both immutable objects validate and commit.
type SSEAssembler ¶
type SSEAssembler struct {
// contains filtered or unexported fields
}
func NewSSEAssembler ¶
func NewSSEAssembler(maxBufferBytes int) *SSEAssembler
func (*SSEAssembler) Feed ¶
func (assembler *SSEAssembler) Feed(chunk ReadChunk) ([]SSELogicalEvent, error)
Feed records one read boundary and emits zero or more logical SSE events. Arbitrary rechunking produces the same event fields while preserving different SourceChunkSequences.
func (*SSEAssembler) Finish ¶
func (assembler *SSEAssembler) Finish() StreamTail
Finish reports an incomplete tail and deliberately does not dispatch it. A caller can therefore return inconclusive instead of inventing a terminal event at EOF.
type SSELogicalEvent ¶
type SSELogicalEvent struct {
Sequence uint64
EventOffset int64
Event string
Data string
ID string
RetryMillis *int64
Fields []SSEField
Issues []string
SourceChunkSequences []uint64
}
SSELogicalEvent is assembled from lines and retains the read chunks that contributed bytes. SourceChunkSequences is provenance, not event identity.