metricsserver

package
v0.17.7 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HistoryFields = []string{"bitrate", "fps"}
View Source
var SeriesFields = []string{
	"t", "viewers", "active", "bitrate",
	"fps_p10", "fps_p50", "fps_p90", "dec_fps_p50",
	"jitter_p50", "jitter_p90",
	"frames_complete", "frames_lost", "pli", "errors",
	"below", "rtt_p50", "rtt_p90", "layers_s0", "layers_s1", "layers_s2",
}
View Source
var ViewerFields = []string{
	"bitrate", "fps", "dec_fps", "buf_fps", "est_dec_fps", "jitter",
	"frames_complete", "frames_lost", "pli", "sid", "tid", "samples", "seen",
	"rtt",
}

Functions

This section is empty.

Types

type Bucket added in v0.17.7

type Bucket struct {
	Index int          `json:"i"`
	Rows  [][3]float64 `json:"r,omitempty"`
}

type History added in v0.17.7

type History struct {
	Offset int          `json:"o"`
	Values [][2]float32 `json:"h"`
}

type Series added in v0.17.7

type Series struct {
	Start      int64       `json:"start"`
	Interval   int64       `json:"interval"`
	Fields     []string    `json:"fields"`
	Points     [][]float64 `json:"points"`
	Thresholds *Thresholds `json:"thresholds,omitempty"`
}

func (Series) Downsample added in v0.17.7

func (series Series) Downsample(limit int) Series

func (Series) Select added in v0.17.7

func (series Series) Select(fields ...string) Series

type Server

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

Server is a lightweight HTTP metrics server that tracks per-viewer stats.

func New

func New(port int) *Server

New creates a Server that will listen on the given port.

func Replay added in v0.17.7

func Replay(r io.Reader, start time.Time) (*Server, error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context) error

ListenAndServe starts the HTTP server and blocks until ctx is cancelled.

func (*Server) RTTSubscriber added in v0.17.7

func (s *Server) RTTSubscriber() func(userID string, rtt time.Duration)

func (*Server) Record added in v0.17.7

func (s *Server) Record(start time.Time, thresholds Thresholds)

func (*Server) Run added in v0.17.7

func (s *Server) Run(ctx context.Context)

func (*Server) Series added in v0.17.7

func (s *Server) Series() Series

func (*Server) ServeHTTP added in v0.17.0

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Snapshot added in v0.17.7

func (s *Server) Snapshot() Snapshot

func (*Server) Subscribe added in v0.17.7

func (s *Server) Subscribe() *Subscriber

func (*Server) Subscriber

func (s *Server) Subscriber() func(vp9_stats.Period, vp9_stats.VideoQualitySample)

Subscriber returns a func compatible with vp9_stats.Publisher.AddSubscriber.

func (*Server) Tick added in v0.17.7

func (s *Server) Tick(now time.Time)

func (*Server) Unsubscribe added in v0.17.7

func (s *Server) Unsubscribe(sub *Subscriber)

type Snapshot added in v0.17.7

type Snapshot struct {
	Series  Series  `json:"series"`
	Viewers Viewers `json:"viewers"`
}

type Subscriber added in v0.17.7

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

func (*Subscriber) Updates added in v0.17.7

func (sub *Subscriber) Updates() <-chan Update

type Thresholds added in v0.17.7

type Thresholds struct {
	MinFPS        float64 `json:"min_fps,omitempty"`
	MinBitrateBps float64 `json:"min_bitrate_bps,omitempty"`
	MaxJitterUS   float64 `json:"max_jitter_us,omitempty"`
	MaxRTTMS      float64 `json:"max_rtt_ms,omitempty"`
}

type Update added in v0.17.7

type Update struct {
	Point   []float64        `json:"p,omitempty"`
	Rows    [][]float64      `json:"v,omitempty"`
	Names   []string         `json:"n,omitempty"`
	Buckets []Bucket         `json:"b,omitempty"`
	Errors  map[string]int32 `json:"e,omitempty"`
	Series  *Series          `json:"series,omitempty"`
	Viewers *Viewers         `json:"viewers,omitempty"`
}

type Viewers added in v0.17.7

type Viewers struct {
	Fields   []string         `json:"fields"`
	Names    []string         `json:"names"`
	Rows     [][]float64      `json:"rows"`
	Start    int64            `json:"start"`
	Interval int64            `json:"interval"`
	History  []History        `json:"history"`
	Errors   map[string]int32 `json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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