metrics

package
v0.0.0-...-8aef35c Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, cfg *config.Config, m *Set, logger *slog.Logger)

Start starts the Prometheus-style metrics HTTP server. It is a no-op when cfg.MetricsAddr is empty.

func StartStatsLoop

func StartStatsLoop(ctx context.Context, m *Set, logger *slog.Logger)

StartStatsLoop starts a goroutine that logs runtime and application stats once per minute. It runs for the lifetime of ctx.

Types

type Set

type Set struct {
	FeedsCrawledTotal  atomic.Uint64
	EmailsSentTotal    atomic.Uint64
	FeedsCrawledErrors atomic.Uint64
}

Set holds application-level counters. It is safe for concurrent use. Pass a *Set by dependency injection instead of using package-level globals.

func (*Set) IncEmailsSent

func (s *Set) IncEmailsSent()

IncEmailsSent atomically increments the emails-sent counter.

func (*Set) IncFeedsCrawled

func (s *Set) IncFeedsCrawled()

IncFeedsCrawled atomically increments the feeds-crawled counter.

func (*Set) IncFeedsCrawledErrors

func (s *Set) IncFeedsCrawledErrors()

IncFeedsCrawledErrors atomically increments the crawl-errors counter.

Jump to

Keyboard shortcuts

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