metrics

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 19 Imported by: 9

Documentation

Index

Constants

View Source
const (
	MetricsLabelDriver     = "driver"
	MetricsLabelKind       = "kind"
	MetricsLabelAppGroup   = "group"
	MetricsLabelName       = "name"
	MetricsLabelNamespace  = "namespace"
	MetricsLabelRepository = "repository"
	MetricsLabelBackend    = "backend"
	MetricsLabelBucket     = "bucket"
	MetricsLabelPrefix     = "prefix"
	MetricLabelInvokerKind = "invoker_kind"
	MetricLabelInvokerName = "invoker_name"
	MetricLabelHostname    = "hostname"
)
View Source
const (
	PushgatewayLocalURL = "http://localhost:56789"
)

Variables

This section is empty.

Functions

func GetPushgatewayURL

func GetPushgatewayURL() string

func SetPushgatewayURL

func SetPushgatewayURL(url string)

Types

type BackupHostMetrics

type BackupHostMetrics struct {
	// BackupSuccess indicates whether the backup for a host succeeded or not
	BackupSuccess prometheus.Gauge
	// BackupDuration indicates total time taken to complete the backup process for a host
	BackupDuration prometheus.Gauge
	// DataSize indicates total size of the target data to backup for a host (in bytes)
	DataSize prometheus.Gauge
	// DataUploaded indicates the amount of data uploaded to the repository for a host (in bytes)
	DataUploaded prometheus.Gauge
	// DataProcessingTime indicates total time taken to backup the target data for a host
	DataProcessingTime prometheus.Gauge
	// FileMetrics shows information of backup files
	FileMetrics *FileMetrics
}

BackupHostMetrics defines Prometheus metrics for individual hosts backup

type BackupMetrics

type BackupMetrics struct {
	// BackupSessionMetrics shows metrics related to entire backup session
	BackupSessionMetrics *BackupSessionMetrics
	// BackupTargetMetrics shows metrics related to a target
	BackupTargetMetrics *BackupTargetMetrics
	// BackupHostMetrics shows backup metrics for individual hosts
	BackupHostMetrics *BackupHostMetrics
}

BackupMetrics defines prometheus metrics for backup process

type BackupSessionMetrics

type BackupSessionMetrics struct {
	// SessionSuccess indicates whether the entire backup session was succeeded or not
	SessionSuccess prometheus.Gauge
	// SessionDuration indicates total time taken to complete the entire backup session
	SessionDuration prometheus.Gauge
	// TargetCount indicates the total number of targets that was backed up in this backup session
	TargetCount prometheus.Gauge
	// LastSuccessTime indicates the time(in unix epoch) when the last BackupSession was succeeded
	LastSuccessTime prometheus.Gauge
}

BackupSessionMetrics defines metrics for entire backup session

type BackupTargetMetrics

type BackupTargetMetrics struct {
	// TargetBackupSucceeded indicates whether the backup for a target has succeeded or not
	TargetBackupSucceeded prometheus.Gauge
	// HostCount indicates the total number of hosts that was backed up for this target
	HostCount prometheus.Gauge
	// LastSuccessTime indicates the time (in unix epoch) when the last backup was successful for this target
	LastSuccessTime prometheus.Gauge
}

BackupTargetMetrics defines metrics related to a target

type FileMetrics

type FileMetrics struct {
	// TotalFiles shows total number of files that has been backed up for a host
	TotalFiles prometheus.Gauge
	// NewFiles shows total number of new files that has been created since last backup for a host
	NewFiles prometheus.Gauge
	// ModifiedFiles shows total number of files that has been modified since last backup for a host
	ModifiedFiles prometheus.Gauge
	// UnmodifiedFiles shows total number of files that has not been changed since last backup for a host
	UnmodifiedFiles prometheus.Gauge
}

FileMetrics defines Prometheus metrics for target files of a backup process for a host

type MetricsOptions

type MetricsOptions struct {
	Enabled        bool
	PushgatewayURL string
	MetricFileDir  string
	Labels         []string
	JobName        string
}

func (*MetricsOptions) SendBackupHostMetrics

func (metricOpt *MetricsOptions) SendBackupHostMetrics(config *rest.Config, i invoker.BackupInvoker, targetRef api_v1beta1.TargetRef, backupOutput *restic.BackupOutput) error

SendBackupSessionMetrics send backup metrics for individual hosts to the Pushgateway

func (*MetricsOptions) SendBackupSessionMetrics

func (metricOpt *MetricsOptions) SendBackupSessionMetrics(inv invoker.BackupInvoker, status api_v1beta1.BackupSessionStatus) error

SendBackupSessionMetrics send backup session related metrics to the Pushgateway

func (*MetricsOptions) SendBackupTargetMetrics

func (metricOpt *MetricsOptions) SendBackupTargetMetrics(config *rest.Config, i invoker.BackupInvoker, targetRef api_v1beta1.TargetRef, status api_v1beta1.BackupSessionStatus) error

SendBackupSessionMetrics send backup session metrics to the Pushgateway

func (*MetricsOptions) SendRepositoryMetrics

func (metricOpt *MetricsOptions) SendRepositoryMetrics(config *rest.Config, i invoker.BackupInvoker, repoStats restic.RepositoryStats) error

SendRepositoryMetrics send backup session related metrics to the Pushgateway

func (*MetricsOptions) SendRestoreHostMetrics

func (metricOpt *MetricsOptions) SendRestoreHostMetrics(config *rest.Config, i invoker.RestoreInvoker, targetRef api_v1beta1.TargetRef, restoreOutput *restic.RestoreOutput) error

SendRestoreHostMetrics send restore metrics for individual hosts to the Pushgateway

func (*MetricsOptions) SendRestoreSessionMetrics

func (metricOpt *MetricsOptions) SendRestoreSessionMetrics(inv invoker.RestoreInvoker) error

SendRestoreSessionMetrics send restore session related metrics to the Pushgateway

func (*MetricsOptions) SendRestoreTargetMetrics

func (metricOpt *MetricsOptions) SendRestoreTargetMetrics(config *rest.Config, i invoker.RestoreInvoker, targetRef api_v1beta1.TargetRef) error

SendRestoreTargetMetrics send restore target related metrics to the Pushgateway

type RepositoryMetrics

type RepositoryMetrics struct {
	// RepoIntegrity shows result of repository integrity check after last backup
	RepoIntegrity prometheus.Gauge
	// RepoSize show size of repository after last backup
	RepoSize prometheus.Gauge
	// SnapshotCount shows number of snapshots stored in the repository
	SnapshotCount prometheus.Gauge
	// SnapshotsRemovedOnLastCleanup shows number of old snapshots cleaned up according to retention policy on last backup session
	SnapshotsRemovedOnLastCleanup prometheus.Gauge
}

RepositoryMetrics defines Prometheus metrics for Repository state after each backup

type RestoreHostMetrics

type RestoreHostMetrics struct {
	// RestoreSuccess indicates whether restore was succeeded or not for a host
	RestoreSuccess prometheus.Gauge
	// RestoreDuration indicates the time taken to complete the restore process for a host
	RestoreDuration prometheus.Gauge
}

RestoreHostMetrics defines restore metrics for the individual hosts

type RestoreMetrics

type RestoreMetrics struct {
	// RestoreSessionMetrics shows metrics related to entire restore session
	RestoreSessionMetrics *RestoreSessionMetrics
	// RestoreTargetMetrics shows metrics related to a restore target
	RestoreTargetMetrics *RestoreTargetMetrics
	// RestoreHostMetrics shows metrics related to the individual host of a restore target
	RestoreHostMetrics *RestoreHostMetrics
}

RestoreMetrics defines metrics for the restore process

type RestoreSessionMetrics

type RestoreSessionMetrics struct {
	// SessionSuccess indicates whether the restore session succeeded or not
	SessionSuccess prometheus.Gauge
	// SessionDuration indicates the total time taken to complete the entire restore session
	SessionDuration prometheus.Gauge
	// TargetCount indicates the number of targets that was restored in this restore session
	TargetCount prometheus.Gauge
}

RestoreSessionMetrics defines metrics related to entire restore session

type RestoreTargetMetrics

type RestoreTargetMetrics struct {
	// TargetRestoreSucceeded indicates whether the restore for a target has succeeded or not
	TargetRestoreSucceeded prometheus.Gauge
	// HostCount indicates the total number of hosts that was restored up for a restore target
	HostCount prometheus.Gauge
}

RestoreTargetMetrics defines metrics related to a restore target

Jump to

Keyboard shortcuts

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