Documentation
¶
Overview ¶
Package obs records bounded, redacted events without opening runtime state on the launch path. Storage and process spooling implement Sink separately.
Index ¶
- Constants
- Variables
- func CompareEvents(a, b Event) int
- func CredentialKey(key string) bool
- func CredentialShaped(value string) bool
- func Fingerprint(event Event) string
- func Go(name string, run func())
- func ProcessTrace(ctx context.Context) context.Context
- func Redact(value any) any
- func SetDefault(sink Sink, metadata Metadata) func()
- func TraceCursor(event Event) string
- func TraceParent(ctx context.Context) string
- func WithRecording(ctx, source context.Context) context.Context
- func WithSink(ctx context.Context, sink Sink, metadata Metadata) context.Context
- func WithTrace(ctx context.Context, header string) context.Context
- type DiagnosticRows
- type Event
- func From(ctx context.Context) *Event
- func IssueEvents(ctx context.Context, home, fingerprint string) ([]Event, error)
- func ParseTraceCursor(trace, cursor string) (Event, error)
- func Query(ctx context.Context, home string, filter Filter) ([]Event, error)
- func Start(ctx context.Context, kind, name string) (context.Context, *Event)
- func TraceEvents(ctx context.Context, home, trace string) ([]Event, error)
- type Filter
- type Issue
- type IssueCount
- type Metadata
- type Queue
- type Sink
- type Spool
- type SpoolOptions
- type SpoolStats
- type Store
- func (s *Store) Close() error
- func (s *Store) Dropped() uint64
- func (s *Store) Flush(ctx context.Context) error
- func (s *Store) ForwardErrors(ctx context.Context, main string, send func(context.Context, []Event) error) error
- func (s *Store) Import(ctx context.Context, events []Event) error
- func (s *Store) IngestSpool(ctx context.Context) (SpoolStats, error)
- func (s *Store) Write(event Event)
- type StoreOptions
- type Trace
- type TracePage
Constants ¶
const MaxEventBytes = 32 << 10
const MaxSpoolBytes = 16 << 20
const TracePageSize = 16
Variables ¶
var ErrIssueNotFound = errors.New("diagnostic issue not found")
Functions ¶
func CompareEvents ¶
CompareEvents uses the persisted timestamp precision and stable identities across spool ingestion.
func CredentialKey ¶
func CredentialShaped ¶
CredentialShaped is shared with Library capture; keep one credential policy.
func Fingerprint ¶
func Redact ¶
Redact accepts JSON-shaped attributes. Unknown types are omitted rather than invoking arbitrary String/MarshalJSON methods that might reveal credentials.
func SetDefault ¶
SetDefault binds process-owned background work; request events keep their context.
func TraceCursor ¶
func TraceParent ¶
func WithRecording ¶
WithRecording keeps request cancellation and tracing while inheriting a process sink.
Types ¶
type DiagnosticRows ¶
type DiagnosticRows struct {
Nodes []map[string]any `json:"mesh_nodes"`
Sessions []map[string]any `json:"sessions"`
MissingTables []string `json:"unavailable_tables,omitempty"`
}
func RelatedRows ¶
func RelatedRows(ctx context.Context, home string, nodes, sessions []string) (DiagnosticRows, error)
RelatedRows reads only the involved session and mesh-node records, never credentials.
type Event ¶
type Event struct {
TS time.Time `json:"ts"`
DurationUS int64 `json:"duration_us"`
TraceID string `json:"trace_id"`
SpanID string `json:"span_id"`
NodeID string `json:"node_id"`
Proc string `json:"proc"`
Kind string `json:"kind"`
Name string `json:"name"`
Level string `json:"level"`
ErrorTrace bool `json:"error_trace,omitempty"`
Status int `json:"status"`
SessionID string `json:"session_id,omitempty"`
User string `json:"user,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
Stack string `json:"stack,omitempty"`
Attrs map[string]any `json:"attrs"`
// contains filtered or unexported fields
}
func IssueEvents ¶
IssueEvents includes the complete retained traces containing this issue.
func ParseTraceCursor ¶
func (*Event) TraceParent ¶
type Issue ¶
type Issue struct {
Fingerprint string `json:"fingerprint"`
Kind string `json:"kind"`
Title string `json:"title"`
Status string `json:"status"`
Regressed bool `json:"regressed"`
FirstSeen time.Time `json:"first_seen"`
LastSeen time.Time `json:"last_seen"`
Count int64 `json:"count"`
ResolvedAt time.Time `json:"resolved_at,omitzero"`
ResolvedBy string `json:"resolved_by,omitempty"`
ResolvedVersion string `json:"resolved_version,omitempty"`
Note string `json:"note,omitempty"`
Counts []IssueCount `json:"counts"`
Sample *Event `json:"sample,omitempty"`
RecentTraces []string `json:"recent_traces,omitempty"`
}
func ChangeIssue ¶
type IssueCount ¶
type Sink ¶
type Sink interface{ Write(Event) }
Write must return immediately. A slow consumer drops at its bounded queue.
type Spool ¶
type Spool struct {
// contains filtered or unexported fields
}
type SpoolOptions ¶
type SpoolStats ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ForwardErrors ¶
func (s *Store) ForwardErrors(ctx context.Context, main string, send func(context.Context, []Event) error) error
ForwardErrors sends bounded batches from retained days, acknowledging only committed uploads.
func (*Store) Import ¶
Import applies backpressure to bulk ingestion; live event producers use Write.
func (*Store) IngestSpool ¶
func (s *Store) IngestSpool(ctx context.Context) (SpoolStats, error)
type StoreOptions ¶
type Trace ¶
type Trace struct{ ID, Span string }
func ParseTraceParent ¶
ParseTraceParent starts a fresh trace for malformed or all-zero identifiers.