Help us shape the future of Go! Take the 2026 Go Developer Survey

prometheus

package
v0.100.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QueueInvocations = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(QueueInvocationsTotal),
		Help: "The total number of invocations of the queuer function",
	})

	CreatedTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(CreatedTasksTotal),
		Help: "The total number of tasks created",
	})

	RetriedTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(RetriedTasksTotal),
		Help: "The total number of tasks retried",
	})

	SucceededTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(SucceededTasksTotal),
		Help: "The total number of tasks that succeeded",
	})

	FailedTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(FailedTasksTotal),
		Help: "The total number of tasks that failed (in a final state, not including retries)",
	})

	SkippedTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(SkippedTasksTotal),
		Help: "The total number of tasks that were skipped",
	})

	CancelledTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(CancelledTasksTotal),
		Help: "The total number of tasks cancelled",
	})

	AssignedTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(AssignedTasksTotal),
		Help: "The total number of tasks assigned to a worker",
	})

	SchedulingTimedOut = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(SchedulingTimedOutTotal),
		Help: "The total number of tasks that timed out while waiting to be scheduled",
	})

	RateLimited = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(RateLimitedTotal),
		Help: "The total number of tasks that were rate limited",
	})

	QueuedToAssigned = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(QueuedToAssignedTotal),
		Help: "The total number of unique tasks that were queued and later got assigned to a worker",
	})

	QueuedToAssignedTimeBuckets = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:    string(QueuedToAssignedTimeSeconds),
		Help:    "Buckets of time in seconds spent in the queue before being assigned to a worker",
		Buckets: []float64{0.01, 0.02, 0.05, 0.1, 0.5, 1, 2, 5, 15},
	})

	ReassignedTasks = promauto.NewCounter(prometheus.CounterOpts{
		Name: string(ReassignedTasksTotal),
		Help: "The total number of tasks that were reassigned to a worker",
	})
)
View Source
var (
	PubSubPublishDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    string(PubSubPublishDurationSeconds),
		Help:    "Time for the pub/sub backend's Pub call to return; this is publisher-side blocking cost, not broker delivery latency, and is not comparable across backends, which block at different depths before returning.",
		Buckets: pubSubBuckets,
	}, []string{"kind", "topic_kind", "result"})

	PubSubTransit = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    string(PubSubTransitSeconds),
		Help:    "Publish-to-delivery latency computed from the message's published_at stamp; subject to clock skew between publisher and subscriber pods; unstamped messages (older engines) are not observed.",
		Buckets: pubSubBuckets,
	}, []string{"kind", "topic_kind"})
)
View Source
var (
	TenantWorkflowDurationBuckets = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name: string(TenantWorkflowDurationMilliseconds),
		Help: "Duration of workflow execution in milliseconds (DAGs and single tasks)",
		Buckets: []float64{

			0.1,
			0.5,
			1,
			2,
			5,
			10,
			25,
			50,
			100,
			250,
			500,

			1000,
			2500,
			5000,
			10000,
			30000,
			60000,

			300000,
			1800000,
			3600000,
			10800000,
			21600000,
			43200000,
			86400000,
		},
	}, []string{"tenant_id", "workflow_name", "status"})

	TenantQueueInvocations = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantQueueInvocationsTotal),
		Help: "The total number of invocations of the queuer function",
	}, []string{"tenant_id"})

	TenantCreatedTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantCreatedTasksTotal),
		Help: "The total number of tasks created",
	}, []string{"tenant_id"})

	TenantRetriedTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantRetriedTasksTotal),
		Help: "The total number of tasks retried",
	}, []string{"tenant_id"})

	TenantSucceededTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantSucceededTasksTotal),
		Help: "The total number of tasks that succeeded",
	}, []string{"tenant_id"})

	TenantFailedTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantFailedTasksTotal),
		Help: "The total number of tasks that failed (in a final state, not including retries)",
	}, []string{"tenant_id"})

	TenantSkippedTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantSkippedTasksTotal),
		Help: "The total number of tasks that were skipped",
	}, []string{"tenant_id"})

	TenantCancelledTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantCancelledTasksTotal),
		Help: "The total number of tasks cancelled",
	}, []string{"tenant_id"})

	TenantAssignedTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantAssignedTasksTotal),
		Help: "The total number of tasks assigned to a worker",
	}, []string{"tenant_id"})

	TenantSchedulingTimedOut = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantSchedulingTimedOutTotal),
		Help: "The total number of tasks that timed out while waiting to be scheduled",
	}, []string{"tenant_id"})

	TenantRateLimited = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantRateLimitedTotal),
		Help: "The total number of tasks that were rate limited",
	}, []string{"tenant_id"})

	TenantQueuedToAssigned = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantQueuedToAssignedTotal),
		Help: "The total number of unique tasks that were queued and later got assigned to a worker",
	}, []string{"tenant_id"})

	TenantQueuedToAssignedTimeBuckets = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    string(TenantQueuedToAssignedTimeSeconds),
		Help:    "Buckets of time in seconds spent in the queue before being assigned to a worker",
		Buckets: []float64{0.01, 0.02, 0.05, 0.1, 0.5, 1, 2, 5, 15},
	}, []string{"tenant_id"})

	TenantReassignedTasks = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: string(TenantReassignedTasksTotal),
		Help: "The total number of tasks that were reassigned to a worker",
	}, []string{"tenant_id"})

	TenantWorkerSlots = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: string(TenantWorkerSlotsTotal),
			Help: "Total number of slots per worker pool",
		},
		[]string{"tenant_id", "worker_id", "worker_name"},
	)

	TenantUsedWorkerSlots = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: string(TenantUsedWorkerSlotsTotal),
			Help: "Number of used slots per worker pool",
		},
		[]string{"tenant_id", "worker_id", "worker_name"},
	)

	TenantAvailableWorkerSlots = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: string(TenantAvailableWorkerSlotsTotal),
			Help: "Number of available slots per worker pool",
		},
		[]string{"tenant_id", "worker_id", "worker_name"},
	)

	TenantWorkerLabelSlots = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: string(TenantWorkerLabelSlotsTotal),
			Help: "Total number of slots of the given slot type across workers with the given worker label pair",
		},
		[]string{"tenant_id", "label_key", "label_value", "slot_type"},
	)

	TenantUsedWorkerLabelSlots = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: string(TenantUsedWorkerLabelSlotsTotal),
			Help: "Number of used slots of the given slot type across workers with the given worker label pair",
		},
		[]string{"tenant_id", "label_key", "label_value", "slot_type"},
	)

	TenantAvailableWorkerLabelSlots = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: string(TenantAvailableWorkerLabelSlotsTotal),
			Help: "Number of available slots of the given slot type across workers with the given worker label pair",
		},
		[]string{"tenant_id", "label_key", "label_value", "slot_type"},
	)
)

Functions

This section is empty.

Types

type EntitlementChecker added in v0.90.0

type EntitlementChecker interface {
	IsPrometheusMetricsEnabled(ctx context.Context, tenantId uuid.UUID) (bool, error)
}

EntitlementChecker reports whether Prometheus metrics are entitled for a tenant. It is satisfied structurally by repository.TenantEntitlementRepository; defining it locally avoids importing pkg/repository (and the resulting import cycle).

type Gate added in v0.90.0

type Gate struct {
	// contains filtered or unexported fields
}

Gate decides whether per-tenant Prometheus metrics should be collected. When tenantScoped is false (self-hosted/OSS default) every tenant is enabled and the gate is a no-op. When tenantScoped is true, collection is gated on each tenant's prometheus_metrics entitlement, read through a short-lived cache to keep the hot emission paths off the database.

func NewGate added in v0.90.0

func NewGate(checker EntitlementChecker, tenantScoped bool, l *zerolog.Logger) *Gate

NewGate builds a Gate. When tenantScoped is false, Enabled always returns true and the checker is never consulted.

func (*Gate) Enabled added in v0.90.0

func (g *Gate) Enabled(ctx context.Context, tenantId uuid.UUID) bool

Enabled reports whether per-tenant Prometheus metrics should be collected for the tenant. It returns true when the gate is nil or not tenant-scoped. On a lookup error it fails closed (returns false) so unentitled data is not collected.

type GlobalHatchetMetric

type GlobalHatchetMetric string
const (
	QueueInvocationsTotal       GlobalHatchetMetric = "hatchet_queue_invocations_total"
	CreatedTasksTotal           GlobalHatchetMetric = "hatchet_created_tasks_total"
	RetriedTasksTotal           GlobalHatchetMetric = "hatchet_retried_tasks_total"
	SucceededTasksTotal         GlobalHatchetMetric = "hatchet_succeeded_tasks_total"
	FailedTasksTotal            GlobalHatchetMetric = "hatchet_failed_tasks_total"
	SkippedTasksTotal           GlobalHatchetMetric = "hatchet_skipped_tasks_total"
	CancelledTasksTotal         GlobalHatchetMetric = "hatchet_cancelled_tasks_total"
	AssignedTasksTotal          GlobalHatchetMetric = "hatchet_assigned_tasks"
	SchedulingTimedOutTotal     GlobalHatchetMetric = "hatchet_scheduling_timed_out"
	RateLimitedTotal            GlobalHatchetMetric = "hatchet_rate_limited"
	QueuedToAssignedTotal       GlobalHatchetMetric = "hatchet_queued_to_assigned"
	QueuedToAssignedTimeSeconds GlobalHatchetMetric = "hatchet_queued_to_assigned_time_seconds"
	ReassignedTasksTotal        GlobalHatchetMetric = "hatchet_reassigned_tasks"
)

type PubSubHatchetMetric added in v0.98.10

type PubSubHatchetMetric string
const (
	PubSubPublishDurationSeconds PubSubHatchetMetric = "hatchet_pubsub_publish_duration_seconds"
	PubSubTransitSeconds         PubSubHatchetMetric = "hatchet_pubsub_transit_seconds"
)

type TenantHatchetMetric

type TenantHatchetMetric string
const (
	TenantWorkflowDurationMilliseconds   TenantHatchetMetric = "hatchet_tenant_workflow_duration_milliseconds"
	TenantAssignedTasksTotal             TenantHatchetMetric = "hatchet_tenant_assigned_tasks"
	TenantSchedulingTimedOutTotal        TenantHatchetMetric = "hatchet_tenant_scheduling_timed_out"
	TenantRateLimitedTotal               TenantHatchetMetric = "hatchet_tenant_rate_limited"
	TenantQueuedToAssignedTotal          TenantHatchetMetric = "hatchet_tenant_queued_to_assigned"
	TenantQueuedToAssignedTimeSeconds    TenantHatchetMetric = "hatchet_tenant_queued_to_assigned_time_seconds"
	TenantQueueInvocationsTotal          TenantHatchetMetric = "hatchet_tenant_queue_invocations"
	TenantCreatedTasksTotal              TenantHatchetMetric = "hatchet_tenant_created_tasks"
	TenantRetriedTasksTotal              TenantHatchetMetric = "hatchet_tenant_retried_tasks"
	TenantSucceededTasksTotal            TenantHatchetMetric = "hatchet_tenant_succeeded_tasks"
	TenantFailedTasksTotal               TenantHatchetMetric = "hatchet_tenant_failed_tasks"
	TenantSkippedTasksTotal              TenantHatchetMetric = "hatchet_tenant_skipped_tasks"
	TenantCancelledTasksTotal            TenantHatchetMetric = "hatchet_tenant_cancelled_tasks"
	TenantReassignedTasksTotal           TenantHatchetMetric = "hatchet_tenant_reassigned_tasks"
	TenantUsedWorkerSlotsTotal           TenantHatchetMetric = "hatchet_tenant_used_worker_slots"
	TenantAvailableWorkerSlotsTotal      TenantHatchetMetric = "hatchet_tenant_available_worker_slots"
	TenantWorkerSlotsTotal               TenantHatchetMetric = "hatchet_tenant_worker_slots"
	TenantUsedWorkerLabelSlotsTotal      TenantHatchetMetric = "hatchet_tenant_used_worker_label_slots"
	TenantAvailableWorkerLabelSlotsTotal TenantHatchetMetric = "hatchet_tenant_available_worker_label_slots"
	TenantWorkerLabelSlotsTotal          TenantHatchetMetric = "hatchet_tenant_worker_label_slots"
)

Jump to

Keyboard shortcuts

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