storj/satellite/metrics/metrics.go
Andrew Harding b562cbf98f satellite/metrics: provide a rangedloop observer
https://github.com/storj/storj/issues/5236

Change-Id: Ic1ed7a5533dccacd58285b64579dbdd6210de4f9
2022-12-09 12:04:39 -07:00

41 lines
1.3 KiB
Go

// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
package metrics
// Metrics represents the metrics that are tracked by this package.
type Metrics struct {
// RemoteObjects is the count of objects with at least one remote segment.
RemoteObjects int64
// InlineObjects is the count of objects with only inline segments.
InlineObjects int64
// TotalInlineBytes is the amount of bytes across all inline segments.
TotalInlineBytes int64
// TotalRemoteBytes is the amount of bytes across all remote segments.
TotalRemoteBytes int64
// TotalInlineSegments is the count of inline segments across all objects.
TotalInlineSegments int64
// TotalRemoteSegments is the count of remote segments across all objects.
TotalRemoteSegments int64
}
// Reset resets the invidual metrics back to zero.
func (metrics *Metrics) Reset() {
*metrics = Metrics{}
}
// Aggregate aggregates the given metrics into the receiver.
func (metrics *Metrics) Aggregate(partial Metrics) {
metrics.RemoteObjects += partial.RemoteObjects
metrics.InlineObjects += partial.InlineObjects
metrics.TotalInlineBytes += partial.TotalInlineBytes
metrics.TotalRemoteBytes += partial.TotalRemoteBytes
metrics.TotalInlineSegments += partial.TotalInlineSegments
metrics.TotalRemoteSegments += partial.TotalRemoteSegments
}