Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BySeriesCount ¶
type BySeriesCount []WALTargetStats
BySeriesCount can sort a slice of target stats by the count of series. The slice is sorted in descending order.
func (BySeriesCount) Len ¶
func (s BySeriesCount) Len() int
func (BySeriesCount) Less ¶
func (s BySeriesCount) Less(i, j int) bool
func (BySeriesCount) Swap ¶
func (s BySeriesCount) Swap(i, j int)
type Cardinality ¶
Cardinality represents some metric by name and the number of times that metric is used with a different combination of unique labels.
func FindCardinality ¶
func FindCardinality(walDir string, job string, instance string) ([]Cardinality, error)
FindCardinality searches the WAL and returns the cardinality of all __name__ series within the WAL for any given series with the label job=<job> and instance=<instance>. All other series are ignored.
type SampleStats ¶
SampleStats are statistics for samples for a series within the WAL. Each instance represents a unique series based on its labels, and holds the range of timestamps found for all samples including the total number of samples for that series.
func FindSamples ¶
func FindSamples(walDir string, selectorStr string) ([]*SampleStats, error)
FindSamples searches the WAL and returns a summary of samples of series matching the given label selector.
type WALStats ¶
type WALStats struct { // From holds the first timestamp for the oldest sample found within the WAL. From time.Time // To holds the last timestamp for the newest sample found within the WAL. To time.Time // CheckpointNumber is the segment number of the most recently created // checkpoint. CheckpointNumber int // FirstSegment is the segment number of the first (oldest) non-checkpoint // segment file found within the WAL folder. FirstSegment int // FirstSegment is the segment number of the last (newest) non-checkpoint // segment file found within the WAL folder. LastSegment int // InvalidRefs is the number of samples with a ref ID to which there is no // series defined. InvalidRefs int // HashCollisions is the total number of times there has been a hash // collision. A hash collision is any instance in which a hash of labels // is defined by two ref IDs. // // For Grafana Alloy, a hash collision has no negative side effects on data // sent to the remote_write endpoint but may have a noticeable impact on // memory while the collision exists. HashCollisions int // Targets holds stats on specific scrape targets. Targets []WALTargetStats }
WALStats stores statistics on the whole WAL.
func CalculateStats ¶
CalculateStats calculates the statistics of the WAL for the given directory. walDir must be a folder containing segment files and checkpoint directories.
type WALTargetStats ¶
type WALTargetStats struct { // Job corresponds to the "job" label on the scraped target. Job string // Instance corresponds to the "instance" label on the scraped target. Instance string // Series is the total number of series for the scraped target. It is // equivalent to the total cardinality. Series int // Samples is the total number of samples for the scraped target. Samples int }
WALTargetStats aggregates statistics on scrape targets across the entirety of the WAL and its checkpoints.