metrics

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StoryRun metrics
	StoryRunsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_storyruns_total",
			Help: "Total number of StoryRuns processed",
		},
		[]string{"namespace", "story", "phase"},
	)

	StoryRunDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "bobrapet_storyrun_duration_seconds",
			Help:    "Duration of StoryRun execution",
			Buckets: []float64{1, 5, 15, 30, 60, 300, 600, 1800, 3600},
		},
		[]string{"namespace", "story", "phase"},
	)

	StoryRunStepsActive = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "bobrapet_storyrun_steps_active",
			Help: "Number of currently active steps in StoryRuns",
		},
		[]string{"namespace", "story"},
	)

	StoryRunStepsCompleted = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "bobrapet_storyrun_steps_completed",
			Help: "Number of completed steps in StoryRuns",
		},
		[]string{"namespace", "story"},
	)

	// StepRun metrics
	StepRunsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_stepruns_total",
			Help: "Total number of StepRuns processed",
		},
		[]string{"namespace", "engram", "phase"},
	)

	StepRunDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "bobrapet_steprun_duration_seconds",
			Help:    "Duration of StepRun execution",
			Buckets: []float64{0.1, 0.5, 1, 5, 15, 30, 60, 300},
		},
		[]string{"namespace", "engram", "phase"},
	)

	StepRunRetries = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_steprun_retries_total",
			Help: "Total number of StepRun retries",
		},
		[]string{"namespace", "engram", "reason"},
	)

	// Controller metrics
	ControllerReconcileTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_controller_reconcile_total",
			Help: "Total number of reconciles by controller",
		},
		[]string{"controller", "result"},
	)

	ControllerReconcileDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "bobrapet_controller_reconcile_duration_seconds",
			Help:    "Duration of controller reconcile operations",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"controller"},
	)

	ControllerReconcileErrors = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_controller_reconcile_errors_total",
			Help: "Total number of reconcile errors",
		},
		[]string{"controller", "error_type"},
	)

	// CEL evaluation metrics
	CELEvaluationDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "bobrapet_cel_evaluation_duration_seconds",
			Help:    "Duration of CEL expression evaluation",
			Buckets: []float64{0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1},
		},
		[]string{"expression_type"},
	)

	CELEvaluationTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_cel_evaluation_total",
			Help: "Total number of CEL expression evaluations",
		},
		[]string{"expression_type", "result"},
	)

	CELCacheHits = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_cel_cache_hits_total",
			Help: "Total number of CEL compilation cache hits",
		},
		[]string{"cache_type"},
	)

	// Resource cleanup metrics
	ResourceCleanupTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_resource_cleanup_total",
			Help: "Total number of resource cleanup operations",
		},
		[]string{"resource_type", "result"},
	)

	ResourceCleanupDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "bobrapet_resource_cleanup_duration_seconds",
			Help:    "Duration of resource cleanup operations",
			Buckets: []float64{0.1, 0.5, 1, 5, 10, 30},
		},
		[]string{"resource_type"},
	)

	// Job execution metrics
	JobExecutionTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_job_execution_total",
			Help: "Total number of Job executions",
		},
		[]string{"namespace", "image", "result"},
	)

	JobExecutionDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "bobrapet_job_execution_duration_seconds",
			Help:    "Duration of Job execution",
			Buckets: []float64{1, 5, 15, 30, 60, 300, 600, 1800},
		},
		[]string{"namespace", "image"},
	)

	// Quota violation metrics
	QuotaViolationTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobrapet_quota_violation_total",
			Help: "Total number of quota violations",
		},
		[]string{"namespace", "resource_type", "violation_type"},
	)

	// Resource quota metrics
	ResourceQuotaUsage = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "bobrapet_resource_quota_usage",
			Help: "Current resource quota usage",
		},
		[]string{"namespace", "resource_type"},
	)

	ResourceQuotaLimit = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "bobrapet_resource_quota_limit",
			Help: "Resource quota limits",
		},
		[]string{"namespace", "resource_type"},
	)

	// gRPC Transport (bobravoz-grpc) metrics
	GRPCStreamRequests = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobravoz_grpc_stream_requests_total",
			Help: "Total number of streaming RPC requests by status code",
		},
		[]string{"method", "code"},
	)

	GRPCStreamDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "bobravoz_grpc_stream_duration_seconds",
			Help:    "Duration of streaming RPCs in seconds",
			Buckets: []float64{.1, .5, 1, 5, 10, 30, 60, 300},
		},
		[]string{"method"},
	)

	GRPCMessagesReceived = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobravoz_grpc_messages_received_total",
			Help: "Total messages received on streaming RPCs",
		},
		[]string{"storyrun", "step"},
	)

	GRPCMessagesSent = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobravoz_grpc_messages_sent_total",
			Help: "Total messages sent on streaming RPCs",
		},
		[]string{"storyrun", "step"},
	)

	GRPCMessagesDropped = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "bobravoz_grpc_messages_dropped_total",
			Help: "Total messages dropped due to buffer overflow or errors",
		},
		[]string{"storyrun", "step", "reason"},
	)
)

Functions

func RecordArtifactOperation

func RecordArtifactOperation(operation string, duration time.Duration, err error)

RecordArtifactOperation records artifact management operations

func RecordCELCacheHit

func RecordCELCacheHit(cacheType string)

RecordCELCacheHit records CEL cache hit

func RecordCELEvaluation

func RecordCELEvaluation(expressionType string, duration time.Duration, err error)

RecordCELEvaluation records CEL evaluation metrics

func RecordCleanupOperation

func RecordCleanupOperation(resourceType, namespace string, deletedCount int, duration time.Duration, err error)

RecordCleanupOperation records cleanup operations

func RecordControllerReconcile

func RecordControllerReconcile(controller string, duration time.Duration, err error)

RecordControllerReconcile records controller reconcile metrics

func RecordGRPCMessageDropped

func RecordGRPCMessageDropped(storyRun, step, reason string)

RecordGRPCMessageDropped records a dropped message with a reason

func RecordGRPCMessageReceived

func RecordGRPCMessageReceived(storyRun, step string)

RecordGRPCMessageReceived records a message received on a stream

func RecordGRPCMessageSent

func RecordGRPCMessageSent(storyRun, step string)

RecordGRPCMessageSent records a message sent on a stream

func RecordGRPCStreamDuration

func RecordGRPCStreamDuration(method string, durationSeconds float64)

RecordGRPCStreamDuration records the duration of a streaming RPC

func RecordGRPCStreamRequest

func RecordGRPCStreamRequest(method, code string)

RecordGRPCStreamRequest records a streaming RPC request with its result code

func RecordJobExecution

func RecordJobExecution(namespace, image, result string, duration time.Duration)

RecordJobExecution records Job execution metrics

func RecordQuotaViolation

func RecordQuotaViolation(namespace, resourceType, violationType string)

RecordQuotaViolation records quota violation metrics

func RecordResourceCleanup

func RecordResourceCleanup(resourceType string, duration time.Duration, err error)

RecordResourceCleanup records resource cleanup metrics

func RecordStepRunDuration

func RecordStepRunDuration(namespace, storyRunRef, stepName, phase string, duration time.Duration)

RecordStepRunDuration records duration metrics for StepRun operations (alias for consistency)

func RecordStepRunMetrics

func RecordStepRunMetrics(namespace, engram, phase string, duration time.Duration)

RecordStepRunMetrics records metrics for StepRun operations

func RecordStorageOperation

func RecordStorageOperation(provider, operation string, duration time.Duration, err error)

RecordStorageOperation records storage provider operations (placeholder for storage package)

func RecordStoryRunMetrics

func RecordStoryRunMetrics(namespace, story, phase string, duration time.Duration)

RecordStoryRunMetrics records metrics for StoryRun operations

func UpdateResourceQuotaLimit

func UpdateResourceQuotaLimit(namespace, resourceType string, limit float64)

UpdateResourceQuotaLimit updates resource quota limits

func UpdateResourceQuotaUsage

func UpdateResourceQuotaUsage(namespace, resourceType string, usage float64)

UpdateResourceQuotaUsage updates current resource usage

func UpdateStoryRunStepsGauge

func UpdateStoryRunStepsGauge(namespace, story string, active, completed int)

UpdateStoryRunStepsGauge updates the active/completed steps gauge

Types

This section is empty.

Jump to

Keyboard shortcuts

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