telemetry

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package telemetry queries Prometheus for runtime verification signals.

Index

Constants

View Source
const (
	DefaultLookback = 168 * time.Hour
	DefaultStep     = time.Hour
	DefaultTimeout  = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a bounded Prometheus API reader.

func New

func New(config Config) (*Client, error)

New validates local configuration. Runtime endpoint failures are returned by Observe as unavailable evidence, never as fatal scan errors.

func (*Client) Close

func (c *Client) Close()

Close releases connections after the one-shot scan.

func (*Client) Observe

func (c *Client) Observe(ctx context.Context, workloads []Workload, at time.Time) Result

Observe fixes one evaluation timestamp for all chunks and metric families. query_range intentionally evaluates one point (start=end): increase's range selector covers the complete lookback. Step is sent to the API, but does not divide totals into overlapping windows or truncate a partial final hour.

type Config

type Config struct {
	URL         string
	BearerToken string
	CAFile      string
	CertFile    string
	KeyFile     string
	Lookback    time.Duration
	Step        time.Duration
	Timeout     time.Duration
}

Config configures only the supplied Prometheus endpoint. Credentials never become report metadata; redirects are disabled to constrain their destination.

type Observation

type Observation struct {
	Window        string
	Share         *float64
	Plaintext     *bool
	NoTraffic     bool
	UnknownReason string
}

Observation describes observed events only. HTTP request events and TCP connection-opening events are combined; Share is their mixed event fraction, not a request-only fraction. UnknownReason is for control availability.

type Result

type Result struct {
	Observations map[Workload]Observation
	Lookback     string
	DegradedTo   string
	Granted      bool
	Warning      string
}

Result retains per-workload evidence when another namespace fails.

type Workload

type Workload struct{ Namespace, Name string }

Workload identifies a destination without coupling telemetry to the resolver.

Jump to

Keyboard shortcuts

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