telemetry

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package telemetry is the agent-side raw-telemetry tier's control plane (#424, ADR 0001). It wraps the dedicated ports.TelemetryStore with the honesty contract the columnar tier must uphold: ingest is BOUNDED and BACKPRESSURED (overflow at the store-rate stage, or a lost upstream batch seen as a sequence gap, is reported as a telemetry gap on the affected host — never a silent drop); retention is tiered with AUDITED expiry; a sampled window is never presented as complete; and the three retro-hunt patterns are served, including retro-running a detection rule over the hot window.

The columnar store is reached ONLY through the port and appears in no domain type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IngestReport

type IngestReport struct {
	Accepted int
	Dropped  int // shed because the batch exceeded the ingest budget; reported, never silent
	Gap      *ports.TelemetrySequenceGap
}

IngestReport is the honest outcome of one ingest: how many events were accepted, how many were shed at the store-rate stage, and any sequence gap (an upstream — agent/transport — loss made visible).

type Service

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

Service is the telemetry tier control plane.

func NewService

func NewService(store ports.TelemetryStore, audit ports.AuditLogger, clock ports.Clock, budget int) (*Service, error)

NewService validates dependencies. budget > 0 bounds a single ingest; <= 0 is refused (an unbounded telemetry ingest is the failure mode this tier exists to avoid).

func (*Service) Footprint

func (s *Service) Footprint(ctx context.Context) (ports.TelemetryFootprint, error)

Footprint reports the store size so spend is observable.

func (*Service) Hunt

Hunt runs a retro-hunt query and returns its result WITH the completeness metadata (sampled / gaps), so a sampled or lossy window is never presented as complete.

func (*Service) Ingest

func (s *Service) Ingest(ctx context.Context, batch ports.TelemetryBatch) (IngestReport, error)

Ingest admits one batch under the coherent ingest budget. Two stages can report a telemetry gap:

  • a sequence gap vs. the last batch stored for this (host, class) — an upstream loss made visible;
  • the batch exceeding the store-rate budget — the overflow is shed and reported, never dropped silently.

Either gap is audited on the affected host. The accepted prefix is persisted with its sampling rate.

func (*Service) RetroRunRule

RetroRunRule re-runs the shipped detection rules for a class over the hot window and returns the detections that WOULD have fired, alongside the hunt result (so the caller sees whether the window it hunted was complete). This is the first of the three acceptance patterns.

func (*Service) Sweep

func (s *Service) Sweep(ctx context.Context) (ports.SweepReport, error)

Sweep enforces the retention tiers and AUDITS the expiry (never a silent deletion): the warm window is down-sampled and past-warm data is expired, with the counts recorded.

Jump to

Keyboard shortcuts

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