telemetry

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// TenantContextKey is used to pass resolved tenant IDs from handlers to middleware telemetry.
	TenantContextKey = "telemetry_tenant_id"
)

Variables

This section is empty.

Functions

func ShouldTrackRequestPath

func ShouldTrackRequestPath(path string) bool

Types

type BatchStoreObservation

type BatchStoreObservation struct {
	At           time.Time
	TenantWrites map[string]int
	Status       int
	Latency      time.Duration
}

type Event

type Event struct {
	At        time.Time `json:"at"`
	Type      string    `json:"type"`
	Method    string    `json:"method,omitempty"`
	Path      string    `json:"path,omitempty"`
	TenantID  string    `json:"tenant_id,omitempty"`
	Status    int       `json:"status"`
	LatencyMS int64     `json:"latency_ms"`
	Detail    string    `json:"detail,omitempty"`
}

type MinuteCount

type MinuteCount struct {
	Minute time.Time `json:"minute"`
	Count  int64     `json:"count"`
}

type Options

type Options struct {
	RequestWindowMinutes int
	EventBufferSize      int
}

type RequestObservation

type RequestObservation struct {
	At       time.Time
	Method   string
	Path     string
	TenantID string
	Status   int
	Latency  time.Duration
}

type SearchObservation

type SearchObservation struct {
	At       time.Time
	TenantID string
	Status   int
	Latency  time.Duration
}

type Service

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

func NewService

func NewService(opts Options) *Service

func (*Service) RecordBatchStore

func (s *Service) RecordBatchStore(obs BatchStoreObservation)

func (*Service) RecordRequest

func (s *Service) RecordRequest(obs RequestObservation)

func (*Service) RecordSearch

func (s *Service) RecordSearch(obs SearchObservation)

func (*Service) RecordStore

func (s *Service) RecordStore(obs StoreObservation)

func (*Service) RequestFinished

func (s *Service) RequestFinished()

func (*Service) RequestStarted

func (s *Service) RequestStarted()

func (*Service) Snapshot

func (s *Service) Snapshot(opts SnapshotOptions) Snapshot

type Snapshot

type Snapshot struct {
	GeneratedAt          time.Time     `json:"generated_at"`
	ActiveRequests       int64         `json:"active_requests"`
	StoreCount           int64         `json:"store_count"`
	BatchStoreCount      int64         `json:"batch_store_count"`
	SearchCount          int64         `json:"search_count"`
	RequestsPerMinute    []MinuteCount `json:"requests_per_minute"`
	RecentEvents         []Event       `json:"recent_events"`
	TopTenantsByWrites   []TenantStat  `json:"top_tenants_by_writes"`
	TopTenantsBySearches []TenantStat  `json:"top_tenants_by_searches"`
}

type SnapshotOptions

type SnapshotOptions struct {
	Events     int
	TopTenants int
}

type StoreObservation

type StoreObservation struct {
	At       time.Time
	TenantID string
	Status   int
	Latency  time.Duration
}

type TenantStat

type TenantStat struct {
	TenantID string `json:"tenant_id"`
	Writes   int64  `json:"writes"`
	Searches int64  `json:"searches"`
}

Jump to

Keyboard shortcuts

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