storage

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TelemetryDatabase

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

TelemetryDatabase implements the MetricStore interface and provides storage for a metric.

func New

func New(dbURI string) (*TelemetryDatabase, error)

New returns a new TelemetryDatabase backed by database/sql.

func (*TelemetryDatabase) Close

func (db *TelemetryDatabase) Close() error

Close closes the database.

func (*TelemetryDatabase) DeletePublishedOlderThan

func (db *TelemetryDatabase) DeletePublishedOlderThan(ctx context.Context, duration time.Duration) error

DeletePublishedOlderThan deletes metrics other than provided duration.

func (*TelemetryDatabase) FetchMetrics

func (db *TelemetryDatabase) FetchMetrics(ctx context.Context, published bool, amount int) ([]telemetry.Metric, error)

FetchMetrics fetches unplished metrics.

func (*TelemetryDatabase) MarkAsPublished

func (db *TelemetryDatabase) MarkAsPublished(ctx context.Context, rowids []int64) error

MarkAsPublished marks metrics as published.

func (*TelemetryDatabase) StoreMetric

func (db *TelemetryDatabase) StoreMetric(ctx context.Context, metric telemetry.Metric) error

StoreMetric persists a metric.

Directories

Path Synopsis
Package migrations generated by go-bindata.// sources: migrations/001_system_metrics.up.sql migrations/002_system_metrics.down.sql
Package migrations generated by go-bindata.// sources: migrations/001_system_metrics.up.sql migrations/002_system_metrics.down.sql

Jump to

Keyboard shortcuts

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