metrics

package
v0.2.3-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 3 Imported by: ? 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

Index

Constants

View Source
const (
	OutcomeJobCompleted     = "job_completed"
	OutcomeIdleScaleDown    = "idle_scaledown"
	OutcomeBootstrapTimeout = "bootstrap_timeout"
	OutcomeProviderError    = "provider_error"
	OutcomeOrphaned         = "orphaned"
	OutcomeManualDelete     = "manual_delete"
	OutcomeStartupRecovery  = "startup_recovery"
)

Lifecycle outcomes recorded in RunnerLifecycleCount. These describe the reason a runner was scheduled for removal.

View Source
const (
	ProviderErrKindTimeout    = "timeout"
	ProviderErrKindProvider   = "provider_error"
	ProviderErrKindDecode     = "decode_error"
	ProviderErrKindValidation = "validation_error"
)

Error kinds recorded in ProviderOperationErrorsCount.

Variables

View Source
var (
	EnterpriseInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsEnterpriseSubsystem,
		Name:      "info",
		Help:      "Info of the enterprise",
	}, []string{"name", "id"})

	EnterprisePoolManagerStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsEnterpriseSubsystem,
		Name:      "pool_manager_status",
		Help:      "Status of the enterprise pool manager",
	}, []string{"name", "id", "running"})
)
View Source
var (
	GithubOperationCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsGithubSubsystem,
		Name:      "operations_total",
		Help:      "Total number of forge (github, gitea) operation attempts",
	}, []string{"operation", "scope", "endpoint"})

	GithubOperationFailedCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsGithubSubsystem,
		Name:      "errors_total",
		Help:      "Total number of failed forge (github, gitea) operation attempts",
	}, []string{"operation", "scope", "endpoint"})

	// GitHub rate limit metrics
	GithubRateLimitLimit = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsGithubSubsystem,
		Name:      "rate_limit_limit",
		Help:      "The maximum number of requests allowed per hour for GitHub API",
	}, []string{"credential_name", "credential_id", "endpoint"})

	GithubRateLimitRemaining = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsGithubSubsystem,
		Name:      "rate_limit_remaining",
		Help:      "The number of requests remaining in the current rate limit window",
	}, []string{"credential_name", "credential_id", "endpoint"})

	GithubRateLimitUsed = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsGithubSubsystem,
		Name:      "rate_limit_used",
		Help:      "The number of requests used in the current rate limit window",
	}, []string{"credential_name", "credential_id", "endpoint"})

	GithubRateLimitResetTimestamp = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsGithubSubsystem,
		Name:      "rate_limit_reset_timestamp",
		Help:      "Unix timestamp when the rate limit resets",
	}, []string{"credential_name", "credential_id", "endpoint"})

	// GithubTokenExpirationTimestamp records when a credential's token
	// expires, as reported by the forge. PATs created without an expiration
	// and forges that do not report one emit no series; app credentials are
	// excluded since their tokens rotate automatically. Alert on this before
	// the expiry turns into a wall of API errors.
	GithubTokenExpirationTimestamp = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsGithubSubsystem,
		Name:      "token_expiration_timestamp",
		Help:      "Unix timestamp when the credential's token expires, if reported by the forge",
	}, []string{"credential_name", "credential_id", "endpoint"})
)
View Source
var (
	InstanceStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRunnerSubsystem,
		Name:      "status",
		Help:      "Status of the instance",
	}, []string{"name", "status", "runner_status", "pool_owner", "pool_type", "pool_id", "scaleset_id", "provider"})

	InstanceOperationCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRunnerSubsystem,
		Name:      "operations_total",
		Help:      "Total number of instance operation attempts",
	}, []string{"operation", "provider", "pool_id", "scaleset_id", "entity_type", "entity_id"})

	InstanceOperationFailedCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRunnerSubsystem,
		Name:      "errors_total",
		Help:      "Total number of failed instance operation attempts",
	}, []string{"operation", "provider", "pool_id", "scaleset_id", "entity_type", "entity_id"})
)
View Source
var (
	// RunnerProvisionDuration measures the time from instance record
	// creation until the provider reports the instance as running.
	RunnerProvisionDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRunnerSubsystem,
		Name:      "provision_duration_seconds",
		Help:      "Time from runner creation until the provider reports it running",
		Buckets:   runnerDurationBuckets,
	}, []string{"provider", "pool_owner", "pool_type"})

	// RunnerReadyDuration measures the time from instance record creation
	// until the runner first reports as idle or active on the forge. This is
	// the end-to-end time until a runner can actually pick up jobs.
	RunnerReadyDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRunnerSubsystem,
		Name:      "ready_duration_seconds",
		Help:      "Time from runner creation until it first reports idle or active on the forge",
		Buckets:   runnerDurationBuckets,
	}, []string{"provider", "pool_owner", "pool_type"})

	// RunnerDeletionDuration measures the time from a runner being marked
	// for deletion until it is fully removed. Long tails here point at stuck
	// or failing provider deletions (leaked compute).
	RunnerDeletionDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRunnerSubsystem,
		Name:      "deletion_duration_seconds",
		Help:      "Time from a runner being marked for deletion until it is removed",
		Buckets:   runnerDurationBuckets,
	}, []string{"provider"})

	// RunnerLifecycleCount counts runner removal decisions by reason. A
	// spike in bootstrap_timeout typically means a broken image, network or
	// userdata; provider_error points at the IaaS.
	RunnerLifecycleCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRunnerSubsystem,
		Name:      "lifecycle_events_total",
		Help:      "Total number of runner removal decisions, by outcome",
	}, []string{"outcome", "provider", "pool_owner", "pool_type", "pool_id", "scaleset_id"})

	// JobQueueDuration measures the time jobs spend queued before a runner
	// picks them up. This is the primary end-user SLO for a CI platform.
	JobQueueDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsJobsSubsystem,
		Name:      "queue_duration_seconds",
		Help:      "Time a workflow job spent queued before it started running",
		Buckets:   jobQueueBuckets,
	}, []string{"owner"})

	// JobExecutionDuration measures how long jobs run once started.
	JobExecutionDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsJobsSubsystem,
		Name:      "execution_duration_seconds",
		Help:      "Time a workflow job spent running, from started to completed",
		Buckets:   jobExecutionBuckets,
	}, []string{"owner"})

	// JobsCompletedCount counts completed jobs by conclusion. This is the
	// controller's job throughput counter.
	JobsCompletedCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsJobsSubsystem,
		Name:      "completed_total",
		Help:      "Total number of workflow jobs completed, by conclusion",
	}, []string{"owner", "repository", "conclusion"})
)
View Source
var (
	// ScaleSetMessagesCount counts scale set job messages received from the
	// forge, by message type (JobAvailable, JobAssigned, JobStarted,
	// JobCompleted). This is the demand signal feed for scale sets.
	ScaleSetMessagesCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "messages_total",
		Help:      "Total number of scale set job messages received, by message type",
	}, []string{"id", "message_type"})

	// ScaleSetListenerLastSuccess records the unix timestamp of the last
	// successful long-poll cycle for a scale set listener, including empty
	// polls. A stale timestamp means the scale set has silently stopped
	// receiving scaling signals.
	ScaleSetListenerLastSuccess = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "listener_last_success_timestamp",
		Help:      "Unix timestamp of the last successful scale set listener poll cycle",
	}, []string{"id"})

	// ScaleSetListenerRestartsCount counts scale set listener restarts.
	// Frequent restarts point at credential or network trouble with the
	// message session.
	ScaleSetListenerRestartsCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "listener_restarts_total",
		Help:      "Total number of scale set listener restarts",
	}, []string{"id"})
)
View Source
var (
	OrganizationInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsOrganizationSubsystem,
		Name:      "info",
		Help:      "Info of the organization",
	}, []string{"name", "id"})

	OrganizationPoolManagerStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsOrganizationSubsystem,
		Name:      "pool_manager_status",
		Help:      "Status of the organization pool manager",
	}, []string{"name", "id", "running"})
)
View Source
var (
	PoolInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsPoolSubsystem,
		Name:      "info",
		Help:      "Info of the pool",
	}, []string{"id", "image", "flavor", "prefix", "os_type", "os_arch", "tags", "provider", "pool_owner", "pool_type"})

	PoolStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsPoolSubsystem,
		Name:      "status",
		Help:      "Status of the pool",
	}, []string{"id", "enabled"})

	PoolMaxRunners = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsPoolSubsystem,
		Name:      "max_runners",
		Help:      "Maximum number of runners in the pool",
	}, []string{"id"})

	PoolMinIdleRunners = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsPoolSubsystem,
		Name:      "min_idle_runners",
		Help:      "Minimum number of idle runners in the pool",
	}, []string{"id"})

	PoolBootstrapTimeout = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsPoolSubsystem,
		Name:      "bootstrap_timeout",
		Help:      "Runner bootstrap timeout in the pool",
	}, []string{"id"})
)
View Source
var (
	// ProviderOperationDuration measures the execution time of successful
	// external provider operations.
	ProviderOperationDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsProviderSubsystem,
		Name:      "operation_duration_seconds",
		Help:      "Execution time of successful provider operations",
		Buckets:   providerOpBuckets,
	}, []string{"provider", "operation", "pool_id", "scaleset_id", "entity_type", "entity_id"})

	// ProviderOperationErrorsCount counts failed provider operations by
	// error kind. Complements garm_runner_errors_total with the error kind
	// dimension.
	ProviderOperationErrorsCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsProviderSubsystem,
		Name:      "operation_errors_total",
		Help:      "Total number of failed provider operations, by error kind",
	}, []string{"provider", "operation", "pool_id", "scaleset_id", "entity_type", "entity_id", "error_kind"})
)
View Source
var (
	RepositoryInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRepositorySubsystem,
		Name:      "info",
		Help:      "Info of the enterprise",
	}, []string{"name", "id"})

	RepositoryPoolManagerStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsRepositorySubsystem,
		Name:      "pool_manager_status",
		Help:      "Status of the enterprise pool manager",
	}, []string{"name", "id", "running"})
)
View Source
var (
	ScaleSetInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "info",
		Help:      "Info of the scale set",
	}, []string{"id", "scaleset_id", "name", "image", "flavor", "prefix", "os_type", "os_arch", "tags", "provider", "runner_group", "scaleset_owner", "scaleset_type"})

	ScaleSetStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "status",
		Help:      "Status of the scale set",
	}, []string{"id", "enabled", "state"})

	ScaleSetMaxRunners = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "max_runners",
		Help:      "Maximum number of runners in the scale set",
	}, []string{"id"})

	ScaleSetMinIdleRunners = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "min_idle_runners",
		Help:      "Minimum number of idle runners in the scale set",
	}, []string{"id"})

	ScaleSetDesiredRunnerCount = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "desired_runner_count",
		Help:      "Desired runner count requested by GitHub for the scale set",
	}, []string{"id"})

	ScaleSetBootstrapTimeout = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsScaleSetSubsystem,
		Name:      "bootstrap_timeout",
		Help:      "Runner bootstrap timeout in the scale set",
	}, []string{"id"})
)
View Source
var (
	// WatcherEventsCount counts database change events published to the
	// watcher. This is the change-feed heartbeat of the controller.
	WatcherEventsCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsWatcherSubsystem,
		Name:      "events_total",
		Help:      "Total number of database change events published to the watcher",
	}, []string{"entity_type", "operation"})

	// WatcherNotifyTimeoutsCount counts database change notifications that
	// were dropped because the watcher could not accept them within the
	// notify timeout. The database write itself succeeded, but downstream
	// consumers (caches, workers) did not see the event. Any nonzero value
	// means internal state may be stale.
	WatcherNotifyTimeoutsCount = prometheus.NewCounter(prometheus.CounterOpts{
		Namespace: metricsNamespace,
		Subsystem: metricsWatcherSubsystem,
		Name:      "notify_timeouts_total",
		Help:      "Total number of database change notifications dropped on watcher backpressure",
	})
)
View Source
var BuildInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Namespace: metricsNamespace,
	Name:      "build_info",
	Help:      "Build information of the running garm controller",
}, []string{"version", "go_version"})

BuildInfo exposes the controller build as labels on a constant gauge. It is set once at registration time.

View Source
var GarmHealth = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Namespace: metricsNamespace,
	Name:      "health",
	Help:      "Health of the garm",
}, []string{"metadata_url", "callback_url", "webhook_url", "controller_webhook_url", "controller_id"})
View Source
var JobStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Namespace: metricsNamespace,
	Subsystem: metricsJobsSubsystem,
	Name:      "status",
	Help:      "List of workflow jobs and their status",
}, []string{
	"job_id",
	"workflow_job_id",
	"workflow_run_id",
	"name",
	"status",
	"conclusion",
	"runner_name",
	"owner",
	"repository",
	"requested_labels",
	"pool_id",
})
View Source
var ProviderInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Namespace: metricsNamespace,
	Subsystem: metricsProviderSubsystem,
	Name:      "info",
	Help:      "Info of the organization",
}, []string{"name", "type", "description"})
View Source
var ScaleSetJobStatus = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Namespace: metricsNamespace,
	Subsystem: metricsJobsSubsystem,
	Name:      "scaleset_status",
	Help:      "List of scale set jobs and their status",
}, []string{
	"scaleset_job_id",
	"scaleset_id",
	"workflow_run_id",
	"name",
	"status",
	"result",
	"runner_name",
	"runner_group",
	"owner",
	"repository",
	"requested_labels",
})

ScaleSetJobStatus tracks the jobs GitHub routed to scale sets. The scaleset_id label is GARM's own ID for the scale set, the same one garm_runner_status and garm_scaleset_info carry.

View Source
var WebhooksReceived = prometheus.NewCounterVec(prometheus.CounterOpts{
	Namespace: metricsNamespace,
	Subsystem: metricsWebhookSubsystem,
	Name:      "received",
	Help:      "The total number of webhooks received",
}, []string{"valid", "reason"})

Functions

func Bool2float64 added in v0.1.5

func Bool2float64(b bool) float64

func RegisterMetrics added in v0.1.5

func RegisterMetrics() error

RegisterMetrics registers all the metrics

Types

This section is empty.

Jump to

Keyboard shortcuts

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