Documentation
¶
Index ¶
- Constants
- func ObserveLibraryDownloadDuration(library, registry string, d time.Duration)
- func RecordLibraryCleanup(library string, status libraryevents.CleanupStatus, strategy string)
- func RecordLibraryResolution(library string, result libraryevents.ResolutionResult)
- func RecordVolumeMountAttempt(volumeType, path string, status Status)
- func RecordVolumeUnMountAttempt(status Status)
- func SetLibrariesCachedBytesForLibrary(library string, bytes int64)
- func SetLibrariesCachedForLibrary(library string, count int)
- func SetLibraryVolumeLinksForLibrary(library string, links int)
- type LibraryListener
- func (*LibraryListener) OnLibraryCached(library string, cachedCount int, cachedBytes int64)
- func (*LibraryListener) OnLibraryCleanup(library string, status libraryevents.CleanupStatus, strategy string)
- func (*LibraryListener) OnLibraryDownload(library, registry string, duration time.Duration)
- func (*LibraryListener) OnLibraryEvicted(library string, cachedCount int, cachedBytes int64)
- func (*LibraryListener) OnLibraryResolved(library string, result libraryevents.ResolutionResult)
- func (*LibraryListener) OnSnapshot(s libraryevents.Snapshot)
- func (*LibraryListener) OnVolumeLinked(library string, volumeLinks int)
- func (*LibraryListener) OnVolumeUnlinked(library string, volumeLinks int)
- type MetricsServer
- type Status
Constants ¶
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" )
const (
MetricsPort = 5000
)
Variables ¶
This section is empty.
Functions ¶
func ObserveLibraryDownloadDuration ¶ added in v1.3.0
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 ¶
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
SetLibrariesCachedBytesForLibrary sets the cumulative on-disk size of cached versions for a given library, in bytes.
func SetLibrariesCachedForLibrary ¶ added in v1.3.0
SetLibrariesCachedForLibrary sets the number of cached versions for a library.
func SetLibraryVolumeLinksForLibrary ¶ added in v1.3.0
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