package data

import "github.com/containerd/nydus-snapshotter/pkg/metrics/data"

Index

Variables

var (
	// CredentialRenewals counts credential renewal attempts per image ref,
	// labeled by outcome ("success" or "failure").
	CredentialRenewals = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "snapshotter_credential_renewals_total",
			Help: "Total number of credential renewal attempts, labeled by image ref and result (success or failure).",
		},
		[]string{imageRefLabel, credentialResultLabel},
	)

	// CredentialStoreEntries tracks the number of credentials currently held
	// in the renewal store per image ref.
	CredentialStoreEntries = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "snapshotter_credential_store_entries",
			Help: "Number of credentials currently tracked in the renewal store per image ref.",
		},
		[]string{imageRefLabel},
	)
)
var (
	CachePartialHits = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_partial_hits",
			Help: "Number of partial cache hits (IO needs a part of the chunk)",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CacheWholeHits = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_whole_hits",
			Help: "Number of whole cache hits (IO needs the entire chunk)",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CacheTotalRequests = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_total_requests",
			Help: "Total number of cache read requests. Cache hit percentage = (partial_hits + whole_hits) / total",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CacheEntriesCount = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_entries_count",
			Help: "Number of chunks in ready status",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CachePrefetchDataBytes = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_prefetch_data_bytes",
			Help: "Total amount of data prefetched, in bytes",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CachePrefetchRequestsCount = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_prefetch_requests_count",
			Help: "Total prefetch requests issued from storage/blobs or rafs filesystem layer for each file that needs prefetch",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CachePrefetchWorkers = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_prefetch_workers",
			Help: "Number of prefetch workers",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CachePrefetchUnmergedChunks = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_prefetch_unmerged_chunks",
			Help: "Number of unmerged chunks",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CachePrefetchCumulativeTimeMillis = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_prefetch_cumulative_time_millis",
			Help: "" /* 337 byte string literal not displayed */,
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CachePrefetchTotalDurationMillis = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_prefetch_duration_millis",
			Help: "Total wall clock duration of the prefetch, in milliseconds",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	CacheBufferedBackendSize = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_cache_buffered_backend_size",
			Help: "Size of the buffered backend, in bytes",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)
)
var (
	NydusdEventCount = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "nydusd_lifetime_event_counts",
			Help: "The lifetime events of nydus daemon.",
		},
		[]string{nydusdEventLabel},
	)
	NydusdCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "nydusd_counts",
			Help: "The counts of nydus daemon.",
		},
		[]string{nydusdVersionLabel},
	)
	NydusdRSS = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_rss_kilobytes",
			Help: "Memory usage (RSS) of nydus daemon.",
		},
		[]string{daemonIDLabel},
		ttl.DefaultTTL,
	)
)
var (
	FsTotalRead = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_total_read_bytes",
			Help: "Total bytes read against the nydus filesystem",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)

	FsReadHit = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_read_hits",
			Help: "Total number of successful read operations.",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)
	FsReadError = ttl.NewGaugeVecWithTTL(
		prometheus.GaugeOpts{
			Name: "nydusd_read_errors",
			Help: "Total number of failed read operations.",
		},
		[]string{imageRefLabel},
		ttl.DefaultTTL,
	)
	TotalHungIO = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "nydusd_hung_io_counts",
			Help: "Total number of hung IOs.",
		},
	)
)
var (
	SnapshotEventElapsedHists = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "snapshotter_snapshot_operation_elapsed_milliseconds",
			Help:    "The elapsed time for snapshot events.",
			Buckets: defaultDurationBuckets,
		},
		[]string{snapshotEventLabel},
	)

	CacheUsage = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_cache_usage_kilobytes",
			Help: "Disk usage of snapshotter local cache.",
		},
	)

	CPUUsage = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_cpu_usage_percentage",
			Help: "CPU usage percentage of snapshotter.",
		},
	)

	MemoryUsage = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_memory_usage_kilobytes",
			Help: "Memory usage (RSS) of snapshotter.",
		},
	)

	CPUSystem = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_cpu_system_time_seconds",
			Help: "CPU time of snapshotter in system.",
		},
	)

	CPUUser = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_cpu_user_time_seconds",
			Help: "CPU time of snapshotter in user.",
		},
	)

	Fds = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_fd_counts",
			Help: "Fd counts of snapshotter.",
		},
	)

	RunTime = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_run_time_seconds",
			Help: "Running time of snapshotter from starting.",
		},
	)

	Thread = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_thread_counts",
			Help: "Thread counts of snapshotter.",
		},
	)

	CacheBlobsDeleted = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "snapshotter_cache_blobs_deleted_total",
			Help: "Total number of cache blobs deleted during cleanup.",
		},
	)

	CacheBlobsInUse = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "snapshotter_cache_blobs_in_use",
			Help: "Number of cache blobs currently in use by running daemons.",
		},
	)

	CacheBlobDeletionErrors = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "snapshotter_cache_blob_deletion_errors_total",
			Help: "Total number of errors encountered while deleting cache blobs.",
		},
	)
)
var MetricHists = []*mtypes.MetricHistogram{
	{
		Desc: prometheus.NewDesc(
			"nydusd_cumulative_read_block_bytes",
			"Cumulative read size histogram for different block size, in bytes.",
			[]string{imageRefLabel},
			prometheus.Labels{},
		),
		Buckets: []uint64{1, 4, 16, 64, 128, 512, 1024, 2048},
		GetCounters: func(m *types.FsMetrics) []uint64 {
			return m.BlockCountRead
		},
	},
	{
		Desc: prometheus.NewDesc(
			"nydusd_read_latency_microseconds",
			"Read latency histogram, in microseconds",
			[]string{imageRefLabel},
			prometheus.Labels{},
		),
		Buckets: []uint64{1, 20, 50, 100, 500, 1000, 2000, 4000},
		GetCounters: func(m *types.FsMetrics) []uint64 {
			return m.ReadLatencyDist
		},
	},
}

Fs metric histograms

Source Files

auth.go cache.go daemon.go fs.go labels.go snapshotter.go

Version
v0.15.15 (latest)
Published
Apr 17, 2026
Platform
linux/amd64
Imports
4 packages
Last checked
1 hour ago

Tools for package owners.