reporter

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package reporter streams what a mirror sends the SPECTRE server over one stream. Every stream begins with the mirror's whole state, then sends each quarantine as it begins, so a stream may fail at any time without losing state. Every keepalive interval it sends the call counts if they changed, or else a keepalive. A failed stream is replaced with backoff, and a stream is replaced when it ages, so streams spread across servers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Client            client.Config `embed:""`
	KeepaliveInterval time.Duration `` /* 172-byte string literal not displayed */
	StreamMaxAge      time.Duration `` /* 166-byte string literal not displayed */
	Service           string        `required:"" help:"Service the mirror runs, reported to the SPECTRE server."`
	Environment       string        `required:"" help:"Environment the mirror runs in, such as production-us-west-2, reported to the SPECTRE server."`
	Revision          string        `required:"" help:"Commit of the candidate the mirror runs, reported to the SPECTRE server."`
}

Config configures how a mirror reports to the SPECTRE server.

func (Config) Validate added in v0.48.0

func (c Config) Validate() error

Validate checks that the stream intervals are positive.

type Reporter

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

Reporter streams a mirror's state to the SPECTRE server.

func New

func New(config Config, server *client.Client, calls func() model.Calls, sources ...Source) *Reporter

New reports the state of a mirror, its call counts, and its sources through server.

func (*Reporter) Run

func (r *Reporter) Run(ctx context.Context)

Run keeps a stream open until ctx ends, replacing it when it fails, with backoff, or when it ages. Failures are only logged.

type Source

type Source struct {
	Direction model.Direction
	// Quarantined receives the proxy's quarantine once, when it begins.
	Quarantined <-chan model.Quarantine
}

Source is a proxy whose quarantine a mirror reports.

Jump to

Keyboard shortcuts

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