telemetry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 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

Overview

Package telemetry provides a lightweight, import-cycle-free runtime metrics store. Both internal/relay (writer) and internal/op/ops (reader) use this package without creating a dependency cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snapshot

type Snapshot struct {
	TotalRequests       int64
	TotalFailures       int64
	AvgLatencyMs        float64
	ErrorRate           float64
	P95LatencyMs        float64
	P99LatencyMs        float64
	ThroughputRPS       float64
	ActiveConnections   int64
	ActiveSessions      int64
	StickyBoundSessions int64
	QuotaAlerts         int64
	MemoryMB            int64
	TrendSnapshots      []TrendPoint
	HasTrendData        bool
}

Snapshot holds a point-in-time view of all runtime metrics.

type Store

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

Store holds all runtime metrics in a concurrency-safe way.

func Global

func Global() *Store

Global returns the global metrics store.

func NewStore

func NewStore() *Store

NewStore creates a new metrics store.

func (*Store) ActiveConnectionsDec

func (s *Store) ActiveConnectionsDec()

func (*Store) ActiveConnectionsInc

func (s *Store) ActiveConnectionsInc()

ActiveConnectionsInc increments the active connections counter.

func (*Store) RecordRequest

func (s *Store) RecordRequest(latencyMs int64, success bool)

RecordRequest records a completed relay request.

func (*Store) SetActiveSessions

func (s *Store) SetActiveSessions(n int64)

SetActiveSessions updates the active stream session count (called from relay).

func (*Store) SetQuotaAlerts

func (s *Store) SetQuotaAlerts(n int64)

SetQuotaAlerts updates the quota alert count (called from alert evaluator).

func (*Store) SetStickyBoundSessions

func (s *Store) SetStickyBoundSessions(n int64)

SetStickyBoundSessions updates the sticky session count (called from balancer).

func (*Store) Snapshot

func (s *Store) Snapshot() Snapshot

Snapshot returns a point-in-time snapshot of all runtime metrics.

func (*Store) StartBackground

func (s *Store) StartBackground()

StartBackground begins periodic metric collection (throughput, trend snapshots). Safe to call multiple times.

func (*Store) StopBackground

func (s *Store) StopBackground()

StopBackground stops the background collection goroutines.

type TrendPoint

type TrendPoint struct {
	Timestamp    int64   `json:"timestamp"`
	RequestDelta int64   `json:"request_delta"`
	FailedDelta  int64   `json:"failed_delta"`
	AvgLatencyMs float64 `json:"avg_latency_ms"`
	MemoryMB     int64   `json:"memory_mb"`
}

TrendPoint is a single time-series data point.

Jump to

Keyboard shortcuts

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