metrics

package
v0.0.0-...-4a7eb78 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrefixFailed = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "prompusher_prefix_failed",
			Help: "Total number of failed prefix checks.",
		},
		[]string{"prefix"},
	)
)

Functions

This section is empty.

Types

type Metric

type Metric struct {
	Name   string              `json:"name"`
	Prefix string              `json:"prefix"`
	Labels []map[string]string `json:"labels"`
	Value  float64             `json:"value"`
	Type   string              `json:"type"`
	Help   string              `json:"help"`
}

func (Metric) ValidateMetrics

func (m Metric) ValidateMetrics(withType bool) error

ValidateMetrics validates if metrics fields are not empty

type MetricCollector

type MetricCollector struct {
	PromMetric prometheus.Collector
	Type       string
}

type MetricStore

type MetricStore struct {
	PromColectors map[string]MetricCollector // all prometheus metrics

	Cron *cron.Cron // cron
	// contains filtered or unexported fields
}

func NewMetricStore

func NewMetricStore() *MetricStore

func (*MetricStore) GetMetricsRegistry

func (m *MetricStore) GetMetricsRegistry() *prometheus.Registry

func (*MetricStore) RegisterMetric

func (m *MetricStore) RegisterMetric(metric Metric) error

func (*MetricStore) RegisterPrefix

func (m *MetricStore) RegisterPrefix(prefix string, cronEntry string) error

func (*MetricStore) StartCron

func (m *MetricStore) StartCron()

StartCron starts cron

func (*MetricStore) StopCron

func (m *MetricStore) StopCron()

StopCron stops cron

func (*MetricStore) StoreMetric

func (m *MetricStore) StoreMetric(metric Metric) error

func (*MetricStore) UnregisterMetric

func (m *MetricStore) UnregisterMetric(metric Metric) error

func (*MetricStore) UnregisterPrefix

func (m *MetricStore) UnregisterPrefix(prefix string) error

type RegistrationRequest

type RegistrationRequest struct {
	MetricsName   string              `json:"metrics_name"`
	Labels        []map[string]string `json:"labels"`
	Prefix        string              `json:"prefix"`
	Type          string              `json:"type"`
	CheckSchedule string              `json:"check_schedule"`
	Help          string              `json:"help"`
}

type StoreRequest

type StoreRequest struct {
	MetricsName string              `json:"metrics_name"`
	Prefix      string              `json:"prefix"`
	Labels      []map[string]string `json:"labels"`
	Value       float64             `json:"value"`
}

Jump to

Keyboard shortcuts

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