metrics

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package metrics defines types and helpers used for metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByPlacement

type ByPlacement[T any] struct {
	Local    T
	Shared   T
	External T
}

ByPlacement contains multiple instances of a struct T, one for each possible Placement.

func (*ByPlacement[T]) Get

func (bp *ByPlacement[T]) Get(placement base.Placement) T

func (*ByPlacement[T]) Ptr

func (bp *ByPlacement[T]) Ptr(placement base.Placement) *T

func (*ByPlacement[T]) Set

func (bp *ByPlacement[T]) Set(placement base.Placement, value T)

type CountAndSize

type CountAndSize struct {
	// Count is the number of files.
	Count uint64

	// Bytes is the total size of all files.
	Bytes uint64
}

CountAndSize tracks the count and total size of a set of items.

func (*CountAndSize) Accumulate

func (cs *CountAndSize) Accumulate(other CountAndSize)

Accumulate increases the counts and sizes by the given amounts.

func (*CountAndSize) Dec

func (cs *CountAndSize) Dec(fileSize uint64)

Dec decreases the count and size for a single item.

func (*CountAndSize) Deduct

func (cs *CountAndSize) Deduct(other CountAndSize)

Deduct decreases the counts and sizes by the given amounts.

func (*CountAndSize) Inc

func (cs *CountAndSize) Inc(fileSize uint64)

Inc increases the count and size for a single item.

func (CountAndSize) IsZero

func (cs CountAndSize) IsZero() bool

func (CountAndSize) SafeFormat

func (cs CountAndSize) SafeFormat(w redact.SafePrinter, verb rune)

SafeFormat implements redact.SafeFormatter.

func (CountAndSize) String

func (cs CountAndSize) String() string

func (CountAndSize) Sum

func (cs CountAndSize) Sum(other CountAndSize) CountAndSize

Sum returns the sums of the counts and sizes.

type CountAndSizeByPlacement

type CountAndSizeByPlacement struct {
	ByPlacement[CountAndSize]
}

CountAndSizeByPlacement contains space usage information for a set of files (e.g. blob files, table backings), broken down by where they are stored.

func (*CountAndSizeByPlacement) Accumulate

func (csp *CountAndSizeByPlacement) Accumulate(rhs CountAndSizeByPlacement)

func (*CountAndSizeByPlacement) Dec

func (csp *CountAndSizeByPlacement) Dec(fileSize uint64, placement base.Placement)

func (*CountAndSizeByPlacement) Deduct

func (*CountAndSizeByPlacement) Inc

func (csp *CountAndSizeByPlacement) Inc(fileSize uint64, placement base.Placement)

func (CountAndSizeByPlacement) SafeFormat

func (csp CountAndSizeByPlacement) SafeFormat(w redact.SafePrinter, verb rune)

SafeFormat implements redact.SafeFormatter.

func (CountAndSizeByPlacement) String

func (csp CountAndSizeByPlacement) String() string

func (CountAndSizeByPlacement) Total

type FileCountsAndSizes

type FileCountsAndSizes struct {
	// Tables contains counts and sizes for tables.
	Tables CountAndSizeByPlacement

	// BlobFiles contains counts and sizes for blob files.
	BlobFiles CountAndSizeByPlacement

	// Other contains counts and sizes for other file types (log, manifest, etc).
	// These files are all local.
	Other CountAndSize
}

FileCountsAndSizes contains counts and sizes for all file types.

func (*FileCountsAndSizes) Accumulate

func (cs *FileCountsAndSizes) Accumulate(other FileCountsAndSizes)

Accumulate increases the counts and sizes by the given amounts.

func (*FileCountsAndSizes) Dec

func (cs *FileCountsAndSizes) Dec(
	fileType base.FileType, fileSize uint64, placement base.Placement,
)

Dec decreases the relevant count and size for a single file.

func (*FileCountsAndSizes) Deduct

func (cs *FileCountsAndSizes) Deduct(other FileCountsAndSizes)

Deduct decreases the counts and sizes by the given amounts.

func (*FileCountsAndSizes) Inc

func (cs *FileCountsAndSizes) Inc(
	fileType base.FileType, fileSize uint64, placement base.Placement,
)

Inc increases the relevant count and size for a single file.

func (FileCountsAndSizes) SafeFormat

func (cs FileCountsAndSizes) SafeFormat(w redact.SafePrinter, verb rune)

SafeFormat implements redact.SafeFormatter.

func (FileCountsAndSizes) String

func (cs FileCountsAndSizes) String() string

func (*FileCountsAndSizes) Total

func (cs *FileCountsAndSizes) Total() CountAndSize

Total returns the total count and size of files.

type ValueRetrievalProfile

type ValueRetrievalProfile = bytesprofile.Profile

ValueRetrievalProfile is a profile of separated value retrievals.

Jump to

Keyboard shortcuts

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