metrics

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package metrics provides Prometheus metrics instrumentation for Schedularr.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SchedulesGeneratedTotal counts the total number of schedules generated
	SchedulesGeneratedTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "schedularr_schedules_generated_total",
		Help: "Total number of schedules generated",
	}, []string{"channel_id", "block_name"})

	// ScheduleGenerationDurationSeconds measures the duration of schedule generation
	ScheduleGenerationDurationSeconds = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:    "schedularr_schedule_generation_duration_seconds",
		Help:    "Duration of schedule generation in seconds",
		Buckets: prometheus.DefBuckets,
	})

	// ScheduleErrorsTotal counts the total number of errors during schedule generation
	ScheduleErrorsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "schedularr_schedule_errors_total",
		Help: "Total number of errors during schedule generation",
	}, []string{"error_type"})

	// ProgramsScheduledTotal counts the total number of programs scheduled
	ProgramsScheduledTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "schedularr_programs_scheduled_total",
		Help: "Total number of programs scheduled",
	}, []string{"channel_id", "block_name", "program_type"})

	// SeriesStateUpdatesTotal counts the total number of series state updates
	SeriesStateUpdatesTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "schedularr_series_state_updates_total",
		Help: "Total number of series state updates (e.g., episode progress)",
	}, []string{"show_title"})

	// ConflictsResolvedTotal counts the total number of scheduling conflicts resolved
	ConflictsResolvedTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "schedularr_conflicts_resolved_total",
		Help: "Total number of scheduling conflicts resolved by priority",
	})

	// ScheduleFallbacksTotal counts fallback scenarios during schedule generation
	// Labels: channel_id, block_name, reason (history_exhausted, fallback_filter_error, fallback_no_content, filler_fetch_error, filler_empty)
	ScheduleFallbacksTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "schedularr_schedule_fallbacks_total",
		Help: "Total number of fallback scenarios during schedule generation",
	}, []string{"channel_id", "block_name", "reason"})

	// TunarrAPICallsTotal counts the total number of Tunarr API calls
	TunarrAPICallsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "schedularr_tunarr_api_calls_total",
		Help: "Total number of Tunarr API calls",
	}, []string{"endpoint", "method"})

	// TunarrAPICallDurationSeconds measures the duration of Tunarr API calls
	TunarrAPICallDurationSeconds = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "schedularr_tunarr_api_call_duration_seconds",
		Help:    "Duration of Tunarr API calls in seconds",
		Buckets: prometheus.DefBuckets,
	}, []string{"endpoint", "method"})

	// TunarrAPIErrorsTotal counts the total number of errors during Tunarr API calls
	TunarrAPIErrorsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "schedularr_tunarr_api_errors_total",
		Help: "Total number of errors during Tunarr API calls",
	}, []string{"endpoint", "method", "error_type"})
)

Define Prometheus metrics

Functions

func RegisterMetrics

func RegisterMetrics()

RegisterMetrics registers all custom metrics with the default Prometheus registry. This function is typically called once at application startup.

Types

This section is empty.

Jump to

Keyboard shortcuts

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