metrics

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Metric names
	MetricResourcesProcessed        = "tekton_pruner_controller_resources_processed"
	MetricReconciliationEvents      = "tekton_pruner_controller_reconciliation_events"
	MetricResourcesDeleted          = "tekton_pruner_controller_resources_deleted"
	MetricResourcesErrors           = "tekton_pruner_controller_resources_errors"
	MetricReconciliationDuration    = "tekton_pruner_controller_reconciliation_duration"
	MetricTTLProcessingDuration     = "tekton_pruner_controller_ttl_processing_duration"
	MetricHistoryProcessingDuration = "tekton_pruner_controller_history_processing_duration"
	MetricActiveResourcesCount      = "tekton_pruner_controller_active_resources"
	MetricPendingDeletionsCount     = "tekton_pruner_controller_pending_deletions"
	MetricResourceAgeAtDeletion     = "tekton_pruner_controller_resource_age_at_deletion"

	// Label keys
	LabelNamespace    = "namespace"
	LabelResourceType = "resource_type"
	LabelStatus       = "status"
	LabelReason       = "reason"
	LabelErrorType    = "error_type"
	LabelOperation    = "operation"

	// Label values for resource types
	ResourceTypePipelineRun = "pipelinerun"
	ResourceTypeTaskRun     = "taskrun"

	// Label values for operations
	OperationTTL     = "ttl"
	OperationHistory = "history"

	// Label values for status
	StatusSuccess = "success"
	StatusFailed  = "failed"
	StatusError   = "error"

	// Label values for error types
	ErrorTypeAPI        = "api_error"
	ErrorTypeTimeout    = "timeout"
	ErrorTypeValidation = "validation"
	ErrorTypeInternal   = "internal"
	ErrorTypeNotFound   = "not_found"
	ErrorTypePermission = "permission"
)

Variables

This section is empty.

Functions

func ClassifyError

func ClassifyError(err error) string

ClassifyError determines the error type based on the error

func ErrorAttributes

func ErrorAttributes(resourceType, namespace, errorType, reason string) []attribute.KeyValue

ErrorAttributes creates error-related attributes

func OperationAttributes

func OperationAttributes(resourceType, namespace, operation string) []attribute.KeyValue

OperationAttributes creates operation-related attributes

func ResourceAttributes

func ResourceAttributes(resourceType, namespace string) []attribute.KeyValue

ResourceAttributes creates common resource-related attributes

Types

type Recorder

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

Recorder holds all the OpenTelemetry instruments for recording metrics

func GetRecorder

func GetRecorder() *Recorder

GetRecorder returns the singleton metrics recorder instance

func (*Recorder) NewTimer

func (r *Recorder) NewTimer(labels ...attribute.KeyValue) *Timer

NewTimer creates a new timer for measuring durations

func (*Recorder) RecordReconciliationEvent

func (r *Recorder) RecordReconciliationEvent(ctx context.Context, resourceType, namespace, status string)

RecordReconciliationEvent increments the reconciliation events counter

func (*Recorder) RecordResourceDeleted

func (r *Recorder) RecordResourceDeleted(ctx context.Context, resourceType, namespace, operation string, resourceAge time.Duration)

RecordResourceDeleted increments the resources deleted counter and records age

func (*Recorder) RecordResourceError

func (r *Recorder) RecordResourceError(ctx context.Context, resourceType, namespace, errorType, reason string)

RecordResourceError increments the resources error counter

func (*Recorder) RecordResourceProcessed

func (r *Recorder) RecordResourceProcessed(ctx context.Context, resourceUID types.UID, resourceType, namespace, status string)

RecordResourceProcessed increments the unique resources counter if this UID hasn't been seen before

func (*Recorder) UpdateActiveResourcesCount

func (r *Recorder) UpdateActiveResourcesCount(ctx context.Context, resourceType, namespace string, delta int64)

UpdateActiveResourcesCount updates the active resources gauge

func (*Recorder) UpdatePendingDeletionsCount

func (r *Recorder) UpdatePendingDeletionsCount(ctx context.Context, resourceType, namespace string, delta int64)

UpdatePendingDeletionsCount updates the pending deletions gauge

type Timer

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

Timer represents a duration measurement that can be recorded when stopped

func (*Timer) RecordHistoryProcessingDuration

func (t *Timer) RecordHistoryProcessingDuration(ctx context.Context)

RecordHistoryProcessingDuration records the duration since the timer was created

func (*Timer) RecordReconciliationDuration

func (t *Timer) RecordReconciliationDuration(ctx context.Context)

RecordReconciliationDuration records the duration since the timer was created

func (*Timer) RecordTTLProcessingDuration

func (t *Timer) RecordTTLProcessingDuration(ctx context.Context)

RecordTTLProcessingDuration records the duration since the timer was created

Jump to

Keyboard shortcuts

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