metrics

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GrafanaBackend = "grafana"
	ProxyBackend   = "proxy"
	Namespace      = "grafana"
	Subsystem      = "alerting"
)
View Source
const (
	ModeRemoteSecondary = "remote_secondary"
	ModeRemotePrimary   = "remote_primary"
	ModeRemoteOnly      = "remote_only"
)
View Source
const (
	AlertRuleActiveLabelValue = "active"
	AlertRulePausedLabelValue = "paused"
)

Variables

This section is empty.

Functions

func Instrument

func Instrument(
	method,
	path string,
	action func(*contextmodel.ReqContext) response.Response,
	metrics *API,
) web.Handler

Instrument wraps a middleware, instrumenting the request latencies.

func MakeLabelValue

func MakeLabelValue(path string) string

MakeLabelValue normalizes a path template

Types

type API

type API struct {
	RequestDuration *prometheus.HistogramVec
}

func NewAPIMetrics

func NewAPIMetrics(r prometheus.Registerer) *API

type Alertmanager

type Alertmanager struct {
	Registerer prometheus.Registerer
	*metrics.Alerts
	*AlertmanagerConfigMetrics
}

func NewAlertmanagerMetrics

func NewAlertmanagerMetrics(r prometheus.Registerer) *Alertmanager

NewAlertmanagerMetrics creates a set of metrics for the Alertmanager of each organization.

type AlertmanagerAggregatedMetrics

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

AlertmanagerAggregatedMetrics are metrics collected directly from the registry. Unlike metrics.Alertmanager they are not called within this codebase hence the need for direct collection.

func NewAlertmanagerAggregatedMetrics

func NewAlertmanagerAggregatedMetrics(registries *metrics.TenantRegistries) *AlertmanagerAggregatedMetrics

func (*AlertmanagerAggregatedMetrics) Collect

func (a *AlertmanagerAggregatedMetrics) Collect(out chan<- prometheus.Metric)

func (*AlertmanagerAggregatedMetrics) Describe

func (a *AlertmanagerAggregatedMetrics) Describe(out chan<- *prometheus.Desc)

type AlertmanagerConfigMetrics

type AlertmanagerConfigMetrics struct {
	ConfigHash     *prometheus.GaugeVec
	Matchers       prometheus.Gauge
	MatchRE        prometheus.Gauge
	Match          prometheus.Gauge
	ObjectMatchers prometheus.Gauge
}

type Historian

type Historian struct {
	Info              *prometheus.GaugeVec
	TransitionsTotal  *prometheus.CounterVec
	TransitionsFailed *prometheus.CounterVec
	WritesTotal       *prometheus.CounterVec
	WritesFailed      *prometheus.CounterVec
	WriteDuration     *instrument.HistogramCollector
	BytesWritten      prometheus.Counter
}

func NewHistorianMetrics

func NewHistorianMetrics(r prometheus.Registerer, subsystem string) *Historian

type MultiOrgAlertmanager

type MultiOrgAlertmanager struct {
	Registerer prometheus.Registerer

	ActiveConfigurations     prometheus.Gauge
	DiscoveredConfigurations prometheus.Gauge
	// contains filtered or unexported fields
}

func NewMultiOrgAlertmanagerMetrics

func NewMultiOrgAlertmanagerMetrics(r prometheus.Registerer) *MultiOrgAlertmanager

func (*MultiOrgAlertmanager) GetOrCreateOrgRegistry

func (moa *MultiOrgAlertmanager) GetOrCreateOrgRegistry(id int64) prometheus.Registerer

GetOrCreateOrgRegistry gets or creates a *prometheus.Registry for the specified org. It is safe to call concurrently.

func (*MultiOrgAlertmanager) RemoveOrgRegistry

func (moa *MultiOrgAlertmanager) RemoveOrgRegistry(id int64)

RemoveOrgRegistry removes the *prometheus.Registry for the specified org. It is safe to call concurrently.

type NGAlert

type NGAlert struct {
	// Registerer is used by subcomponents which register their own metrics.
	Registerer prometheus.Registerer
	// contains filtered or unexported fields
}

func NewNGAlert

func NewNGAlert(r prometheus.Registerer) *NGAlert

NewNGAlert manages the metrics of all the alerting components.

func ProvideService

func ProvideService() *NGAlert

ProvideService is a Metrics factory.

func ProvideServiceForTest

func ProvideServiceForTest() *NGAlert

ProvideServiceForTest is a Metrics factory used for test.

func (*NGAlert) GetAPIMetrics

func (ng *NGAlert) GetAPIMetrics() *API

func (*NGAlert) GetHistorianMetrics

func (ng *NGAlert) GetHistorianMetrics() *Historian

func (*NGAlert) GetMultiOrgAlertmanagerMetrics

func (ng *NGAlert) GetMultiOrgAlertmanagerMetrics() *MultiOrgAlertmanager

func (*NGAlert) GetRemoteAlertmanagerMetrics

func (ng *NGAlert) GetRemoteAlertmanagerMetrics() *RemoteAlertmanager

func (*NGAlert) GetSchedulerMetrics

func (ng *NGAlert) GetSchedulerMetrics() *Scheduler

func (*NGAlert) GetStateMetrics

func (ng *NGAlert) GetStateMetrics() *State

type OrgRegistries

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

OrgRegistries represents a map of registries per org.

func NewOrgRegistries

func NewOrgRegistries() *OrgRegistries

func (*OrgRegistries) GetOrCreateOrgRegistry

func (m *OrgRegistries) GetOrCreateOrgRegistry(orgID int64) prometheus.Registerer

GetOrCreateOrgRegistry gets or creates a *prometheus.Registry for the specified org. It is safe to call concurrently.

func (*OrgRegistries) RemoveOrgRegistry

func (m *OrgRegistries) RemoveOrgRegistry(org int64)

RemoveOrgRegistry removes the *prometheus.Registry for the specified org. It is safe to call concurrently.

type RemoteAlertmanager

type RemoteAlertmanager struct {
	Info                  *prometheus.GaugeVec
	RequestLatency        *instrument.HistogramCollector
	LastReadinessCheck    prometheus.Gauge
	ConfigSyncsTotal      prometheus.Counter
	ConfigSyncErrorsTotal prometheus.Counter
	LastConfigSync        prometheus.Gauge
	StateSyncsTotal       prometheus.Counter
	StateSyncErrorsTotal  prometheus.Counter
	LastStateSync         prometheus.Gauge
}

func NewRemoteAlertmanagerMetrics

func NewRemoteAlertmanagerMetrics(r prometheus.Registerer) *RemoteAlertmanager

type Scheduler

type Scheduler struct {
	Registerer                          prometheus.Registerer
	BehindSeconds                       prometheus.Gauge
	EvalTotal                           *prometheus.CounterVec
	EvalFailures                        *prometheus.CounterVec
	EvalDuration                        *prometheus.HistogramVec
	EvalAttemptTotal                    *prometheus.CounterVec
	EvalAttemptFailures                 *prometheus.CounterVec
	ProcessDuration                     *prometheus.HistogramVec
	SendDuration                        *prometheus.HistogramVec
	SimpleNotificationRules             *prometheus.GaugeVec
	GroupRules                          *prometheus.GaugeVec
	Groups                              *prometheus.GaugeVec
	SchedulePeriodicDuration            prometheus.Histogram
	SchedulableAlertRules               prometheus.Gauge
	SchedulableAlertRulesHash           prometheus.Gauge
	UpdateSchedulableAlertRulesDuration prometheus.Histogram
	Ticker                              *ticker.Metrics
	EvaluationMissed                    *prometheus.CounterVec
}

func NewSchedulerMetrics

func NewSchedulerMetrics(r prometheus.Registerer) *Scheduler

type State

type State struct {
	StateUpdateDuration   prometheus.Histogram
	StateFullSyncDuration prometheus.Histogram
	// contains filtered or unexported fields
}

func NewStateMetrics

func NewStateMetrics(r prometheus.Registerer) *State

func (State) Registerer

func (s State) Registerer() prometheus.Registerer

Registerer exposes the Prometheus register directly. The state package needs this as, it uses a collector to fetch the current alerts by state in the system.

Jump to

Keyboard shortcuts

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