Documentation
¶
Index ¶
- Variables
- func RecordGitOperation(gitRepo *v1alpha1.GitRepository, operation GitOperation, ...)
- func RecordSCMCall(gitRepo *v1alpha1.GitRepository, api SCMAPI, operation SCMOperation, ...)
- func RecordWebhookCall(ctpFound bool, responseCode int, duration time.Duration)
- type GitOperation
- type GitOperationResult
- type RateLimit
- type SCMAPI
- type SCMOperation
Constants ¶
This section is empty.
Variables ¶
var ( // FinalizerDependentCount tracks the current number of dependent resources blocking deletion FinalizerDependentCount = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "promoter_finalizer_dependent_resources", Help: "Current number of dependent resources preventing deletion (gauge is cleared when finalizer is removed)", }, []string{"resource_type", "resource_name", "namespace"}, ) // ApplicationWatchEventsHandled tracks the number of times the ArgoCD application event handler is called ApplicationWatchEventsHandled = prometheus.NewCounter( prometheus.CounterOpts{ Name: "application_watch_events_handled_total", Help: "Number of times the ArgoCD application event handler is called.", }, ) )
Functions ¶
func RecordGitOperation ¶
func RecordGitOperation(gitRepo *v1alpha1.GitRepository, operation GitOperation, result GitOperationResult, duration time.Duration)
RecordGitOperation records both the increment and observation for git operations.
func RecordSCMCall ¶
func RecordSCMCall(gitRepo *v1alpha1.GitRepository, api SCMAPI, operation SCMOperation, responseCode int, duration time.Duration, rateLimit *RateLimit)
RecordSCMCall records both the increment and observation for SCM API calls, and optionally observes rate limit metrics.
Types ¶
type GitOperation ¶
type GitOperation string
GitOperation represents the type of git operation being performed.
const ( // GitOperationClone is used when cloning a git repository. GitOperationClone GitOperation = "clone" // GitOperationFetch is used when fetching updates from a git repository. GitOperationFetch GitOperation = "fetch" // GitOperationPull is used when pulling changes from a git repository. GitOperationPull GitOperation = "pull" // GitOperationPush is used when pushing changes to a git repository. GitOperationPush GitOperation = "push" // GitOperationLsRemote is used when listing remote references in a git repository. GitOperationLsRemote GitOperation = "ls-remote" )
type GitOperationResult ¶
type GitOperationResult string
GitOperationResult represents the result of a git operation, indicating whether it was successful or failed.
const ( // GitOperationResultSuccess indicates that the git operation was successful. GitOperationResultSuccess GitOperationResult = "success" // GitOperationResultFailure indicates that the git operation failed. GitOperationResultFailure GitOperationResult = "failure" )
func GitOperationResultFromError ¶
func GitOperationResultFromError(err error) GitOperationResult
GitOperationResultFromError converts an error to a GitOperationResult based on whether the error is nil or not.
type RateLimit ¶
type RateLimit struct {
// Limit is the maximum number of requests allowed in the current rate limit window.
Limit int
// Remaining is the number of requests remaining in the current rate limit window.
Remaining int
// ResetRemaining is the duration until the rate limit resets.
ResetRemaining time.Duration
}
RateLimit represents the rate limit information for SCM API calls.
type SCMAPI ¶
type SCMAPI string
SCMAPI represents the type of API being used in the SCM operations.
type SCMOperation ¶
type SCMOperation string
SCMOperation represents the type of operation being performed on the SCM API.
const ( // SCMOperationCreate is used when creating resources such as pull requests or commit statuses. SCMOperationCreate SCMOperation = "create" // SCMOperationUpdate is used when updating resources such as pull requests. SCMOperationUpdate SCMOperation = "update" // SCMOperationMerge is used when merging pull requests. SCMOperationMerge SCMOperation = "merge" // SCMOperationClose is used when closing pull requests. SCMOperationClose SCMOperation = "close" // SCMOperationList is used when listing resources, such as pull requests. SCMOperationList SCMOperation = "list" )