metrics

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusSuccess represents the success of an operation
	StatusSuccess Status = "success"
	// StatusFailed represents the failure of an operation
	StatusFailed = "failed"
	// StatusUnsupported represents an operation not supported by any publisher
	StatusUnsupported = "unsupported"
)
View Source
const (
	MetricsPort = 5000
)

Variables

This section is empty.

Functions

func ObserveLibraryDownloadDuration added in v1.3.0

func ObserveLibraryDownloadDuration(library, registry string, d time.Duration)

ObserveLibraryDownloadDuration records the duration of a successful library download. The library and registry labels allow breaking down latency per package and per registry endpoint.

func RecordLibraryCleanup added in v1.3.0

func RecordLibraryCleanup(library string, status libraryevents.CleanupStatus, strategy string)

RecordLibraryCleanup records the outcome of a cleanup attempt for an unused library. The library label is the package name (e.g. "dd-lib-java-init"); it may be empty for legacy entries on disk that predate the metadata bucket. The strategy label captures which cleanup policy was active (e.g. "immediate", "delayed").

func RecordLibraryResolution added in v1.3.0

func RecordLibraryResolution(library string, result libraryevents.ResolutionResult)

RecordLibraryResolution records the outcome of an attempt to resolve a library for a volume. The library label is the package name (e.g. "dd-lib-java-init"); it may be empty when the resolution failed before the library was identified.

func RecordVolumeMountAttempt

func RecordVolumeMountAttempt(volumeType, path string, status Status)

RecordVolumeMountAttempt records a volume mount attempt

func RecordVolumeUnMountAttempt

func RecordVolumeUnMountAttempt(status Status)

RecordVolumeUnMountAttempt records a volume unmount attempt

func SetLibrariesCachedBytesForLibrary added in v1.3.0

func SetLibrariesCachedBytesForLibrary(library string, bytes int64)

SetLibrariesCachedBytesForLibrary sets the cumulative on-disk size of cached versions for a given library, in bytes.

func SetLibrariesCachedForLibrary added in v1.3.0

func SetLibrariesCachedForLibrary(library string, count int)

SetLibrariesCachedForLibrary sets the number of cached versions for a library.

func SetLibraryVolumeLinksForLibrary added in v1.3.0

func SetLibraryVolumeLinksForLibrary(library string, links int)

SetLibraryVolumeLinksForLibrary sets the number of volumes currently linked to any cached version of the given library.

Types

type LibraryListener added in v1.3.0

type LibraryListener struct{}

LibraryListener publishes Datadog CSI driver Prometheus metrics in response to library lifecycle events. It implements libraryevents.Listener; the librarymanager package itself does not depend on this package, which keeps the manager's domain logic free from any observability backend.

The listener is stateless and safe for concurrent use.

func NewLibraryListener added in v1.3.0

func NewLibraryListener() *LibraryListener

NewLibraryListener constructs a LibraryListener ready to be passed to librarymanager.WithEventListener.

func (*LibraryListener) OnLibraryCached added in v1.3.0

func (*LibraryListener) OnLibraryCached(library string, cachedCount int, cachedBytes int64)

OnLibraryCached updates the per-library cached gauges with the new aggregate values reported by the manager. The manager guarantees the counts are post-update.

func (*LibraryListener) OnLibraryCleanup added in v1.3.0

func (*LibraryListener) OnLibraryCleanup(library string, status libraryevents.CleanupStatus, strategy string)

OnLibraryCleanup publishes the cleanup outcome counter.

func (*LibraryListener) OnLibraryDownload added in v1.3.0

func (*LibraryListener) OnLibraryDownload(library, registry string, duration time.Duration)

OnLibraryDownload observes the download duration histogram.

func (*LibraryListener) OnLibraryEvicted added in v1.3.0

func (*LibraryListener) OnLibraryEvicted(library string, cachedCount int, cachedBytes int64)

OnLibraryEvicted updates the per-library cached gauges with the new aggregate values reported by the manager. When the last version of a library is evicted both counts are zero, which materialises in Prometheus as a series of value 0 (kept intentionally so dashboards can show "cache is empty" rather than gap).

func (*LibraryListener) OnLibraryResolved added in v1.3.0

func (*LibraryListener) OnLibraryResolved(library string, result libraryevents.ResolutionResult)

OnLibraryResolved publishes the resolution outcome counter.

func (*LibraryListener) OnSnapshot added in v1.3.0

func (*LibraryListener) OnSnapshot(s libraryevents.Snapshot)

OnSnapshot seeds the per-library gauges from the persisted state. Reset is used so libraries that disappeared between two driver runs are not stuck reporting stale values.

func (*LibraryListener) OnVolumeLinked added in v1.3.0

func (*LibraryListener) OnVolumeLinked(library string, volumeLinks int)

OnVolumeLinked updates the per-library volume-links gauge.

func (*LibraryListener) OnVolumeUnlinked added in v1.3.0

func (*LibraryListener) OnVolumeUnlinked(library string, volumeLinks int)

OnVolumeUnlinked updates the per-library volume-links gauge. When the last link for a library is removed the gauge is set to 0 rather than deleted, so dashboards can distinguish "no volume" from "missing series".

type MetricsServer

type MetricsServer interface {
	// Start runs the metrics server.
	// This should be a blocking call until the context is cancelled or done.
	Start(ctx context.Context, errChan chan error)
}

MetricsServer is the metrics server interface

func NewMetricsServer

func NewMetricsServer(port int) (MetricsServer, error)

NewMetricsServer creates a new metrics server

type Status

type Status string

Status represents the status of an operation

Jump to

Keyboard shortcuts

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