Background Execution Metrics Recorder (metrics/background_execution.go)

omnara · observability/metrics/background_execution.go · go · Apache-2.0
analytics, infra, lang:go

Prometheus metrics collector tracking in-flight submissions, totals, durations, and start delays for background job queues.

// Source: https://github.com/omnara-ai/omnara | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package metrics

import (
	"time"

	"github.com/prometheus/client_golang/prometheus"
)

type BackgroundSubmissionResult string

const (
	BackgroundSubmissionAccepted BackgroundSubmissionResult = "accepted"
	BackgroundSubmissionFull     BackgroundSubmissionResult = "full"
	BackgroundSubmissionShutdown BackgroundSubmissionResult = "shutdown"
)

type BackgroundExecutionRecorder struct {
	submissionsInFlight prometheus.Gauge
	submissionsTotal    *prometheus.CounterVec
	submissionDuration  prometheus.Histogram
	startDelay          prometheus.Histogram
}

func NewBackgroundExecutionRecorder(se

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key