events

package
v0.0.0-...-eb3ab3a Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Event Keys
	RepoInit       = "Repo Init"
	RepoConnect    = "Repo Connect"
	BackupEnd      = "Backup End"
	RestoreEnd     = "Restore End"
	ExportEnd      = "Export End"
	MaintenanceEnd = "Maintenance End"

	// Event Data Keys
	BackupCreateTime = "backup_creation_time"
	BackupID         = "backup_id"
	DataRetrieved    = "data_retrieved"
	DataStored       = "data_stored"
	Duration         = "duration"
	EndTime          = "end_time"
	ItemsRead        = "items_read"
	ItemsWritten     = "items_written"
	Resources        = "resources"
	RestoreID        = "restore_id"
	ExportID         = "export_id"
	Service          = "service"
	StartTime        = "start_time"
	Status           = "status"

	// default values for keys
	RepoIDNotFound = "not_found"
)

keys for ease of use

View Source
const (
	APICall metricsCategory = "api_call"
)

metrics collection bucket

Variables

View Source
var (
	RudderStackWriteKey     string
	RudderStackDataPlaneURL string
)

Functions

func Inc

func Inc(cat metricsCategory, keys ...string)

Inc increments the given category by 1.

func IncN

func IncN(n int, cat metricsCategory, keys ...string)

IncN increments the given category by N.

func NewMetrics

func NewMetrics(ctx context.Context, w io.Writer) (context.Context, func())

NewMetrics embeds a metrics bus into the provided context. The bus can be utilized with calls like Inc and Since.

func Since

func Since(start time.Time, cat metricsCategory, keys ...string)

Since records the duration between the provided time and now, in millis.

Types

type Bus

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

Bus handles all event communication into the events package.

func NewBus

func NewBus(ctx context.Context, s storage.Storage, tenID string, co control.Options) (Bus, error)

func (Bus) Close

func (b Bus) Close() error

func (Bus) Event

func (b Bus) Event(ctx context.Context, key string, data map[string]any)

func (*Bus) SetRepoID

func (b *Bus) SetRepoID(hash string)

type Eventer

type Eventer interface {
	Event(context.Context, string, map[string]any)
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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