metrics

package
v3.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 28 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// MetricsPath is the endpoint to collect application metrics
	MetricsPath = "/metrics"
)

Variables

This section is empty.

Functions

func AddMetricsTransportWrapper

func AddMetricsTransportWrapper(server *MetricsServer, app *v1alpha1.Application, config *rest.Config) *rest.Config

AddMetricsTransportWrapper adds a transport wrapper which increments 'argocd_app_k8s_request_total' counter on each kubernetes request

func NewAppCollector

func NewAppCollector(appLister applister.ApplicationLister, appFilter AppFilter, appLabels []string, appConditions []string) prometheus.Collector

NewAppCollector returns a prometheus collector for application metrics

func NewAppRegistry

func NewAppRegistry(appLister applister.ApplicationLister, appFilter AppFilter, appLabels []string, appConditions []string) *prometheus.Registry

NewAppRegistry creates a new prometheus registry that collects applications

func NewClusterCollector

func NewClusterCollector(ctx context.Context, source HasClustersInfo, clusterLister ClusterLister, clusterLabels []string) prometheus.Collector

Types

type AppFilter added in v3.6.0

type AppFilter func(obj any) (keep bool, destServer string, err error)

AppFilter reports whether an Application should be exported, and returns the destination server it resolved on the way. Resolving isn't free, so the collector reuses this instead of resolving again. destServer is empty and err is set when the destination doesn't resolve, which the collector logs per scrape; keep is independent of err, an unresolvable destination is still exported.

type ClusterLister

type ClusterLister func(ctx context.Context) (*argoappv1.ClusterList, error)

type HasClustersInfo

type HasClustersInfo interface {
	GetClustersInfo() []cache.ClusterInfo
}

type MetricsServer

type MetricsServer struct {
	*http.Server
	// contains filtered or unexported fields
}

func NewMetricsServer

func NewMetricsServer(addr string, appLister applister.ApplicationLister, appFilter AppFilter, healthCheck func(r *http.Request) error, appLabels []string, appConditions []string) (*MetricsServer, error)

NewMetricsServer returns a new prometheus server which collects application metrics

func (*MetricsServer) DecKubectlExecPending

func (m *MetricsServer) DecKubectlExecPending(command string)

func (*MetricsServer) HasExpiration

func (m *MetricsServer) HasExpiration() bool

HasExpiration return true if expiration is set

func (*MetricsServer) IncAppSyncDuration added in v3.1.0

func (m *MetricsServer) IncAppSyncDuration(app *argoappv1.Application, destServer string, state *argoappv1.OperationState)

IncAppSyncDuration observes app sync duration

func (*MetricsServer) IncClusterEventsCount

func (m *MetricsServer) IncClusterEventsCount(server, group, kind string)

IncClusterEventsCount increments the number of cluster events

func (*MetricsServer) IncKubectlExec

func (m *MetricsServer) IncKubectlExec(command string)

func (*MetricsServer) IncKubectlExecPending

func (m *MetricsServer) IncKubectlExecPending(command string)

func (*MetricsServer) IncKubernetesRequest

func (m *MetricsServer) IncKubernetesRequest(app *argoappv1.Application, server, statusCode, verb, resourceKind, resourceNamespace string)

IncKubernetesRequest increments the kubernetes requests counter for an application

func (*MetricsServer) IncReconcile

func (m *MetricsServer) IncReconcile(app *argoappv1.Application, destServer string, duration time.Duration)

IncReconcile increments the reconcile counter for an application

func (*MetricsServer) IncRedisRequest

func (m *MetricsServer) IncRedisRequest(command string, failed bool)

func (*MetricsServer) IncSync

func (m *MetricsServer) IncSync(app *argoappv1.Application, destServer string, state *argoappv1.OperationState)

IncSync increments the sync counter for an application

func (*MetricsServer) ObserveRedisRequestDuration

func (m *MetricsServer) ObserveRedisRequestDuration(duration time.Duration)

ObserveRedisRequestDuration observes redis request duration

func (*MetricsServer) ObserveResourceEventsProcessingDuration

func (m *MetricsServer) ObserveResourceEventsProcessingDuration(server string, duration time.Duration, processedEventsNumber int)

ObserveResourceEventsProcessingDuration observes resource events processing duration

func (*MetricsServer) RegisterClustersInfoSource

func (m *MetricsServer) RegisterClustersInfoSource(ctx context.Context, source HasClustersInfo, db db.ArgoDB, clusterLabels []string)

func (*MetricsServer) SetExpiration

func (m *MetricsServer) SetExpiration(cacheExpiration time.Duration) error

SetExpiration reset Prometheus metrics based on time duration interval

func (*MetricsServer) SetOrphanedResourcesMetric

func (m *MetricsServer) SetOrphanedResourcesMetric(app *argoappv1.Application, numOrphanedResources int)

Jump to

Keyboard shortcuts

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