Documentation
¶
Index ¶
- Constants
- func ClassifyError(err error) string
- func ErrorAttributes(resourceType, namespace, errorType, reason string) []attribute.KeyValue
- func OperationAttributes(resourceType, namespace, operation string) []attribute.KeyValue
- func ResourceAttributes(resourceType, namespace string) []attribute.KeyValue
- type Recorder
- func (r *Recorder) NewTimer(labels ...attribute.KeyValue) *Timer
- func (r *Recorder) RecordReconciliationEvent(ctx context.Context, resourceType, namespace, status string)
- func (r *Recorder) RecordResourceDeleted(ctx context.Context, resourceType, namespace, operation string, ...)
- func (r *Recorder) RecordResourceError(ctx context.Context, resourceType, namespace, errorType, reason string)
- func (r *Recorder) RecordResourceProcessed(ctx context.Context, resourceUID types.UID, ...)
- func (r *Recorder) UpdateActiveResourcesCount(ctx context.Context, resourceType, namespace string, delta int64)
- func (r *Recorder) UpdatePendingDeletionsCount(ctx context.Context, resourceType, namespace string, delta int64)
- type Timer
Constants ¶
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 ¶
ClassifyError determines the error type based on the error
func ErrorAttributes ¶
ErrorAttributes creates error-related attributes
func OperationAttributes ¶
OperationAttributes creates operation-related attributes
func ResourceAttributes ¶
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) 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
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer represents a duration measurement that can be recorded when stopped
func (*Timer) RecordHistoryProcessingDuration ¶
RecordHistoryProcessingDuration records the duration since the timer was created
func (*Timer) RecordReconciliationDuration ¶
RecordReconciliationDuration records the duration since the timer was created
func (*Timer) RecordTTLProcessingDuration ¶
RecordTTLProcessingDuration records the duration since the timer was created