storemetrics

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 8 Imported by: ? 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 storemetrics defines the store metrics entry model used for centralized metrics collection.

Index

Constants

View Source
const NATSSubjectPrefix = "sys.metrics"

NATSSubjectPrefix is the base subject for metrics publishing. Full subject: sys.metrics.{service}

View Source
const NATSSubjectWildcard = "sys.metrics.>"

NATSSubjectWildcard matches all service metrics subjects.

Variables

This section is empty.

Functions

func NATSSubject

func NATSSubject(service string) string

NATSSubject returns the NATS subject for a given service name.

Types

type Publisher

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

Publisher periodically collects metrics from stores and publishes them via NATS.

func NewPublisher

func NewPublisher(service string, stores []StoreInfo, interval time.Duration, client *messenger.Client, l *logger.Logger) *Publisher

NewPublisher creates a new metrics publisher.

func (*Publisher) Start

func (p *Publisher) Start()

Start begins periodic metrics collection and publishing.

func (*Publisher) Stop

func (p *Publisher) Stop()

Stop signals the publisher to stop.

type StoreInfo

type StoreInfo struct {
	Name  string       // e.g. "admin.db"
	Store *store.Store // underlying BadgerDB store
}

StoreInfo identifies a store to collect metrics from.

type StoreMetricsEntry

type StoreMetricsEntry struct {
	ID        string        `json:"id"`         // ULID for time-ordered keys
	Timestamp int64         `json:"timestamp"`  // Unix millis
	Hostname  string        `json:"hostname"`   // OS hostname of the publishing node
	Service   string        `json:"service"`    // e.g. "admin_server"
	StoreName string        `json:"store_name"` // e.g. "admin.db"
	Metrics   store.Metrics `json:"metrics"`
}

StoreMetricsEntry represents a single metrics snapshot published by a service.

func NewStoreMetricsEntry

func NewStoreMetricsEntry(service, storeName string, metrics *store.Metrics) *StoreMetricsEntry

NewStoreMetricsEntry creates a new StoreMetricsEntry with a ULID and current timestamp.

Jump to

Keyboard shortcuts

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