go.bigb.es/curator

v1.2.0
Doc Versions Source

Variables

var (
	// HTTP request metrics.
	HTTPRequestsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "goproxy_http_requests_total",
		Help: "Total HTTP requests by handler, method, and status.",
	}, []string{"handler", "method", "code"})

	HTTPRequestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "goproxy_http_request_duration_seconds",
		Help:    "HTTP request duration in seconds.",
		Buckets: prometheus.DefBuckets,
	}, []string{"handler"})

	// Git cache metrics.
	GitReposTotal = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "goproxy_git_repos_total",
		Help: "Number of cached git repositories.",
	})

	GitCacheSizeBytes = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "goproxy_git_cache_size_bytes",
		Help: "Total disk size of git cache directory.",
	})

	GitOperationsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "goproxy_git_operations_total",
		Help: "Total git operations by type (clone, fetch).",
	}, []string{"operation"})

	// S3 storage metrics.
	S3ObjectsTotal = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "goproxy_s3_objects_total",
		Help: "Number of objects in S3 bucket.",
	})

	S3SizeBytes = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "goproxy_s3_size_bytes",
		Help: "Total size of objects in S3 bucket.",
	})

	S3OperationsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "goproxy_s3_operations_total",
		Help: "Total S3 operations by type and result.",
	}, []string{"operation", "result"})

	// Proxy cache metrics.
	ProxyCacheHitsTotal = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "goproxy_cache_hits_total",
		Help: "Total S3 cache hits.",
	})

	ProxyCacheMissesTotal = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "goproxy_cache_misses_total",
		Help: "Total S3 cache misses.",
	})

	// Module metrics.
	ModulesConfigured = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "goproxy_modules_configured",
		Help: "Number of modules in config.",
	})

	// Sum database metrics.
	SumdbRecordsTotal = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "goproxy_sumdb_records_total",
		Help: "Number of records in the sumdb transparency log.",
	})

	SumdbLookupsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "goproxy_sumdb_lookups_total",
		Help: "Total sumdb lookups by result (hit, miss).",
	}, []string{"result"})

	SumdbTreeSize = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "goproxy_sumdb_tree_size",
		Help: "Current sumdb transparency log tree size.",
	})

	// Documentation metrics.
	DocRendersTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "goproxy_doc_renders_total",
		Help: "Total documentation page renders by type.",
	}, []string{"type"})
)

Functions

f func Register

src
func Register()

f func StartCollector

src
func StartCollector(ctx context.Context, cacheDir string, moduleCount ModuleCountFunc, bucketStats BucketStatsFunc, recordCount RecordCountFunc, interval time.Duration)

Types

T type BucketStatsFunc

src
type BucketStatsFunc func(ctx context.Context) (objects int64, sizeBytes int64, err error)

BucketStatsFunc returns object count and total size for S3 metrics collection.

T type ModuleCountFunc

src
type ModuleCountFunc func() int

StartCollector periodically updates gauge metrics. ModuleCountFunc returns the number of configured modules.

T type RecordCountFunc

src
type RecordCountFunc func() int64

RecordCountFunc returns the number of sumdb records.

Source Files