Documentation
¶
Overview ¶
Package logread is the thin pure-Go function-log reader (ADR-0084): it merges the compacted Parquet (ADR-0083) with the recent raw OTLP-JSONL tail (ADR-0081) over the blob.Bucket port, filters by time/severity/limit, and returns a tenant's function logs time-ordered. No DuckDB, no cgo, lakehouse-independent. Tenant scoping is the caller's concern (the control-plane PEP authorizes the namespace before calling Read); this package just reads the namespace it is given.
Index ¶
Constants ¶
const ( // DefaultLimit caps a read when Query.Limit is unset. DefaultLimit = 1000 // MaxLimit hard-caps a read (≈ a few MB of lines — bounds a runaway scan). MaxLimit = 10000 )
const SinceForms = v1.DurationGrammar + " or " + v1.TimestampForm
SinceForms names the two forms the logs routes' since parameter takes (#824): a duration in ADR-0194's grammar or a timestamp in ADR-0196's form. The API and funcdctl refuse anything else with it.
Variables ¶
This section is empty.
Functions ¶
func SeverityNumber ¶
SeverityNumber maps a level name (trace|debug|info|warn|error|fatal, case-insensitive) to its OTLP SeverityNumber threshold (the lowest number at that level); ok=false for an unknown name. "" ⇒ (0, true) = no filter.
Types ¶
type BlobReader ¶
type BlobReader struct {
// contains filtered or unexported fields
}
BlobReader is the blob-backed Reader (compacted Parquet + raw OTLP-JSONL tail over blob.Bucket).
func NewBlobReader ¶
func NewBlobReader(b blob.Bucket) *BlobReader
NewBlobReader builds the reader over the funcd-system observability bucket.
type Line ¶
type Line struct {
Time v1.Timestamp `json:"time" doc:"When the worker wrote the line."`
Severity string `json:"severity" doc:"The line's level: TRACE, DEBUG, INFO, WARN, ERROR or FATAL."`
SeverityNumber int32 `` /* 190-byte string literal not displayed */
Body string `json:"body" doc:"The line's text."`
Namespace string `json:"namespace" doc:"The Function's namespace."`
Function string `json:"function" doc:"The Function whose worker wrote the line."`
Replica string `json:"replica" doc:"The replica of the worker that wrote the line."`
Source string `json:"source" doc:"Where the worker wrote the line: console, logging, stdout or stderr."`
Invocation string `json:"inv,omitempty" doc:"The ID of the call during which the worker wrote the line, when one is known."`
TraceID string `json:"traceId,omitempty" doc:"The trace of that call, as 32 hexadecimal digits, when one is known."`
SpanID string `json:"spanId,omitempty" doc:"The span of that call, as 16 hexadecimal digits, when one is known."`
Attrs json.RawMessage `json:"attrs,omitempty" doc:"The line's other attributes, as a JSON object."`
}
Line is one log record returned to a caller (the wire + CLI DTO; a friendlier view of compact.Row).
type Query ¶
type Query struct {
Namespace string
Function string
Since time.Time // zero ⇒ no lower bound
MinSeverityNumber int32 // 0 ⇒ all severities
Limit int // <= 0 ⇒ DefaultLimit; capped at MaxLimit
// TraceID scopes the read to one run's trace (ADR-0106): "" ⇒ no trace filter (ADR-0084 per-function
// behavior). When Function == "" && TraceID != "", Read scans the whole logs/<ns>/ prefix (namespace-wide,
// run-scoped) — every step function's lines for that run, incl. sub-workflow children (same trace, ADR-0104).
TraceID string
}
Query selects + bounds a read. Namespace is required; Function OR TraceID must be set (a bare namespace scan with no trace filter is rejected — see Read's guard). The rest are optional filters.