observability

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMetric

type AgentMetric struct {
	InstanceID  string `json:"instance_id"`
	MetricName  string `json:"metric_name"`
	MetricValue int64  `json:"metric_value"`
	Period      string `json:"period"`
}

AgentMetric is a single metric record for an agent in a time period.

type AgentSummary

type AgentSummary struct {
	InstanceID string           `json:"instance_id"`
	Metrics    map[string]int64 `json:"metrics"`
}

AgentSummary is an aggregate view of all metrics for one agent.

type Store

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

Store provides per-agent metric aggregation in hourly buckets.

func New

func New(db *sql.DB) *Store

New creates a new observability Store.

func (*Store) Increment

func (s *Store) Increment(ctx context.Context, instanceID, metricName string) error

Increment adds 1 to the named metric for the given instance in the current hourly bucket.

func (*Store) IncrementBy

func (s *Store) IncrementBy(ctx context.Context, instanceID, metricName string, delta int64) error

IncrementBy adds delta to the named metric for the given instance in the current hourly bucket.

func (*Store) QueryAgent

func (s *Store) QueryAgent(ctx context.Context, instanceID, period string) ([]AgentMetric, error)

QueryAgent returns all metrics for a specific agent, optionally filtered by period prefix. If period is empty, returns all periods. If period is e.g. "2026-02-16", returns all hours that day.

func (*Store) QueryAll

func (s *Store) QueryAll(ctx context.Context, period string) ([]AgentMetric, error)

QueryAll returns metrics for all agents, optionally filtered by period prefix.

func (*Store) Summarize

func (s *Store) Summarize(ctx context.Context, period string) ([]AgentSummary, error)

Summarize returns aggregated metric totals per agent (across all periods, or filtered by period prefix).

Jump to

Keyboard shortcuts

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