Documentation
¶
Overview ¶
Package stats provides runtime statistics and metrics collection.
Index ¶
- Constants
- Variables
- func Init(config *MetricsConfig) error
- func PushNow() error
- func PushWithContext(ctx context.Context) error
- func SetInitializedForTesting(val bool) bool
- type MetricInterface
- func BookmarkTotalCounter() MetricInterface
- func BotRunTotalCounter(rulesetLabel RulesetLabel) MetricInterface
- func BotTotalCounter() MetricInterface
- func CacheEvictionTotalCounter(backend string) MetricInterface
- func CacheHitTotalCounter(backend string) MetricInterface
- func CacheMissTotalCounter(backend string) MetricInterface
- func CacheSizeBytesGauge(backend string) MetricInterface
- func DockerContainerTotalCounter() MetricInterface
- func EventTotalCounter() MetricInterface
- func GiteaIssueTotalCounter(status string) MetricInterface
- func KanbanEventTotalCounter(name string) MetricInterface
- func KanbanTaskTotalCounter() MetricInterface
- func ModuleRunTotalCounter(rulesetLabel RulesetLabel) MetricInterface
- func ModuleTotalCounter() MetricInterface
- func MonitorDownTotalCounter() MetricInterface
- func MonitorUpTotalCounter() MetricInterface
- func QueueFailedTasksTotalCounter(taskType string) MetricInterface
- func QueueInProgressTasksCounter(taskType string) MetricInterface
- func QueueProcessedTasksTotalCounter(taskType string) MetricInterface
- func ReaderTotalCounter() MetricInterface
- func ReaderUnreadTotalCounter() MetricInterface
- func TorrentDownloadTotalCounter() MetricInterface
- func TorrentStatusTotalCounter(status string) MetricInterface
- type MetricsConfig
- type RulesetLabel
- type Stats
- func (s *Stats) RegisterCounterVec(name, help string, labelNames ...string) (*prometheus.CounterVec, error)
- func (s *Stats) RegisterGaugeVec(name, help string, labelNames ...string) (*prometheus.GaugeVec, error)
- func (s *Stats) RegisterHistogramVec(name, help string, labelNames ...string) (*prometheus.HistogramVec, error)
Constants ¶
const ( BotTotalStatsName = "bot_total" BotRunTotalStatsName = "bot_run_total" ModuleTotalStatsName = "module_total" ModuleRunTotalStatsName = "module_run_total" BookmarkTotalStatsName = "bookmark_total" QueueProcessedTasksTotalStatsName = "queue_processed_tasks_total" QueueFailedTasksTotalStatsName = "queue_failed_tasks_total" QueueInProgressTasksStatsName = "queue_in_progress_tasks" EventTotalStatsName = "event_total" TorrentDownloadTotalStatsName = "torrent_download_total" TorrentStatusTotalStatsName = "torrent_status_total" GiteaIssueTotalStatsName = "gitea_issue_total" KanbanEventTotalStatsName = "kanban_event_total" KanbanTaskTotalStatsName = "kanban_task_total" ReaderTotalStatsName = "reader_total" ReaderUnreadTotalStatsName = "reader_unread_total" MonitorUpTotalStatsName = "monitor_up_total" MonitorDownTotalStatsName = "monitor_down_total" DockerContainerTotalStatsName = "docker_container_total" )
const ( CacheHitTotalStatsName = "cache_hit_total" CacheMissTotalStatsName = "cache_miss_total" CacheEvictionTotalStatsName = "cache_eviction_total" CacheSizeBytesStatsName = "cache_size_bytes" )
Variables ¶
var ErrNilStats = errors.New("stats: called on nil Stats")
ErrNilStats is returned when Register* methods are called on a nil Stats receiver.
Functions ¶
func PushNow ¶ added in v0.35.1
func PushNow() error
PushNow immediately pushes metrics to pushgateway
func PushWithContext ¶ added in v0.35.1
PushWithContext pushes metrics using a context
func SetInitializedForTesting ¶ added in v0.92.0
SetInitializedForTesting sets the initialized flag for test purposes. Returns the previous value.
Types ¶
type MetricInterface ¶ added in v0.35.1
MetricInterface compatibility interface supporting common methods for Counter and Gauge
func BookmarkTotalCounter ¶ added in v0.18.1
func BookmarkTotalCounter() MetricInterface
func BotRunTotalCounter ¶ added in v0.18.1
func BotRunTotalCounter(rulesetLabel RulesetLabel) MetricInterface
func BotTotalCounter ¶ added in v0.18.1
func BotTotalCounter() MetricInterface
func CacheEvictionTotalCounter ¶ added in v0.92.0
func CacheEvictionTotalCounter(backend string) MetricInterface
CacheEvictionTotalCounter returns a metric for tracking cache eviction count by backend.
func CacheHitTotalCounter ¶ added in v0.92.0
func CacheHitTotalCounter(backend string) MetricInterface
CacheHitTotalCounter returns a metric for tracking cache hit count by backend.
func CacheMissTotalCounter ¶ added in v0.92.0
func CacheMissTotalCounter(backend string) MetricInterface
CacheMissTotalCounter returns a metric for tracking cache miss count by backend.
func CacheSizeBytesGauge ¶ added in v0.92.0
func CacheSizeBytesGauge(backend string) MetricInterface
CacheSizeBytesGauge returns a metric for tracking approximate cache memory usage by backend.
func DockerContainerTotalCounter ¶ added in v0.30.2
func DockerContainerTotalCounter() MetricInterface
func EventTotalCounter ¶ added in v0.18.1
func EventTotalCounter() MetricInterface
func GiteaIssueTotalCounter ¶ added in v0.22.1
func GiteaIssueTotalCounter(status string) MetricInterface
func KanbanEventTotalCounter ¶ added in v0.23.1
func KanbanEventTotalCounter(name string) MetricInterface
func KanbanTaskTotalCounter ¶ added in v0.29.3
func KanbanTaskTotalCounter() MetricInterface
func ModuleRunTotalCounter ¶ added in v0.92.0
func ModuleRunTotalCounter(rulesetLabel RulesetLabel) MetricInterface
ModuleRunTotalCounter is an alias for BotRunTotalCounter using the new module naming.
func ModuleTotalCounter ¶ added in v0.92.0
func ModuleTotalCounter() MetricInterface
ModuleTotalCounter is an alias for BotTotalCounter using the new module naming.
func MonitorDownTotalCounter ¶ added in v0.35.1
func MonitorDownTotalCounter() MetricInterface
func MonitorUpTotalCounter ¶ added in v0.35.1
func MonitorUpTotalCounter() MetricInterface
func QueueFailedTasksTotalCounter ¶ added in v0.18.1
func QueueFailedTasksTotalCounter(taskType string) MetricInterface
func QueueInProgressTasksCounter ¶ added in v0.18.1
func QueueInProgressTasksCounter(taskType string) MetricInterface
func QueueProcessedTasksTotalCounter ¶ added in v0.18.1
func QueueProcessedTasksTotalCounter(taskType string) MetricInterface
func ReaderTotalCounter ¶ added in v0.24.1
func ReaderTotalCounter() MetricInterface
func ReaderUnreadTotalCounter ¶ added in v0.24.1
func ReaderUnreadTotalCounter() MetricInterface
func TorrentDownloadTotalCounter ¶ added in v0.21.2
func TorrentDownloadTotalCounter() MetricInterface
func TorrentStatusTotalCounter ¶ added in v0.21.2
func TorrentStatusTotalCounter(status string) MetricInterface
type MetricsConfig ¶ added in v0.35.1
MetricsConfig configuration struct
type RulesetLabel ¶ added in v0.18.1
type RulesetLabel string
const ( InputRuleset RulesetLabel = "input" AgentRuleset RulesetLabel = "agent" CommandRuleset RulesetLabel = "command" CronRuleset RulesetLabel = "cron" FormRuleset RulesetLabel = "form" )
type Stats ¶ added in v0.92.0
type Stats struct {
// contains filtered or unexported fields
}
Stats provides access to the global Prometheus registry for creating vector metrics.
func NewStats ¶ added in v0.92.0
func NewStats() *Stats
NewStats creates a Stats wrapper around the global Prometheus registry. Returns a singleton instance. Returns nil when metrics has not been initialized (metrics.enabled=false).
func (*Stats) RegisterCounterVec ¶ added in v0.92.0
func (s *Stats) RegisterCounterVec(name, help string, labelNames ...string) (*prometheus.CounterVec, error)
RegisterCounterVec creates or returns an existing CounterVec registered with the global registry.
func (*Stats) RegisterGaugeVec ¶ added in v0.92.0
func (s *Stats) RegisterGaugeVec(name, help string, labelNames ...string) (*prometheus.GaugeVec, error)
RegisterGaugeVec creates or returns an existing GaugeVec registered with the global registry.
func (*Stats) RegisterHistogramVec ¶ added in v0.92.0
func (s *Stats) RegisterHistogramVec(name, help string, labelNames ...string) (*prometheus.HistogramVec, error)
RegisterHistogramVec creates or returns an existing HistogramVec registered with the global registry.