metrics

package
v1.8.11 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package metrics collects string constants used to report anonymous usage metrics.

Index

Constants

View Source
const (
	// Setup is used to group metrics related to bridge setup e.g. first start, new user.
	Setup = Category("setup")

	// FirstStart signifies that the bridge has been started for the first time on a user's
	// machine (or at least, no config directory was found).
	FirstStart = Action("first_start")

	// NewUser signifies a new user account has been added to the bridge.
	NewUser = Action("new_user")
)

Metrics related to bridge/account setup.

View Source
const (
	// Heartbeat is used to group heartbeat metrics e.g. the daily alive signal.
	Heartbeat = Category("heartbeat")

	// Daily is a daily signal that indicates continued bridge usage.
	Daily = Action("daily")
)

Metrics related to heartbeats of various kinds.

View Source
const (
	// Import is used to group import metrics.
	Import = Category("import")

	// Export is used to group export metrics.
	Export = Category("export")

	// TransferLoad signifies that the transfer load source.
	// It can be IMAP or local files for import, or PM for export.
	// With this will be reported also label with number of source mailboxes.
	TransferLoad = Action("load")

	// TransferStart signifies started transfer.
	TransferStart = Action("start")

	// TransferComplete signifies completed transfer without crash.
	TransferComplete = Action("complete")

	// TransferCancel signifies cancelled transfer by an user.
	TransferCancel = Action("cancel")

	// TransferFail signifies stopped transfer because of an fatal error.
	TransferFail = Action("fail")
)

Metrics related to import-export (transfer) process.

View Source
const NoLabel = Label("")

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

type Category

type Category string

type Label

type Label string

type Metric

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

Metric represents a single metric that can be reported and contains the necessary fields of category, action and label that the /metrics endpoint expects.

func New

func New(c Category, a Action, l Label) Metric

New returns a metric struct with the given category, action and label. Maybe in future we could perform checks here that the correct category is given for each action. That's why the Metric fields are not exported; we don't want users creating broken metrics (though for now they still can do that).

func (Metric) Get

func (m Metric) Get() (Category, Action, Label)

Get returns the category, action and label of a metric.

Jump to

Keyboard shortcuts

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