dbrollup

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultInterval is the default time between rollups.
	// Rollups will be synchronized with the clock so that
	// they happen 13:00, 13:05, 13:10, etc.
	DefaultInterval = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Init               bool `json:"-"`
	TemplateUsageStats bool `json:"template_usage_stats"`
}

type Option

type Option func(*Rolluper)

func WithEventChannel

func WithEventChannel(ch chan<- Event) Option

WithEventChannel sets the event channel to use for rollup events.

This is only used for testing.

func WithInterval

func WithInterval(interval time.Duration) Option

WithInterval sets the interval between rollups.

type Rolluper

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

func New

func New(logger slog.Logger, db database.Store, opts ...Option) *Rolluper

New creates a new DB rollup service that periodically runs rollup queries. It is the caller's responsibility to call Close on the returned instance.

This is for e.g. generating insights data (template_usage_stats) from raw data (workspace_agent_stats, workspace_app_stats).

func (*Rolluper) Close

func (r *Rolluper) Close() error

Jump to

Keyboard shortcuts

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