commonmetrics

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OperationLatencyKey is the key for stargz operation latency metrics.
	OperationLatencyKey = "operation_duration"

	// OperationCountKey is the key for stargz operation count metrics.
	OperationCountKey = "operation_count"

	// BytesServedKey is the key for any metric related to counting bytes served as the part of specific operation.
	BytesServedKey = "bytes_served"
)
View Source
const (
	// prometheus metrics
	Mount                         = "mount"
	RemoteRegistryGet             = "remote_registry_get"
	NodeReaddir                   = "node_readdir"
	StargzHeaderGet               = "stargz_header_get"
	StargzFooterGet               = "stargz_footer_get"
	StargzTocGet                  = "stargz_toc_get"
	DeserializeTocJSON            = "stargz_toc_json_deserialize"
	PrefetchesCompleted           = "all_prefetches_completed"
	ReadOnDemand                  = "read_on_demand"
	MountLayerToLastOnDemandFetch = "mount_layer_to_last_on_demand_fetch"

	OnDemandReadAccessCount          = "on_demand_read_access_count"
	OnDemandRemoteRegistryFetchCount = "on_demand_remote_registry_fetch_count"
	OnDemandBytesServed              = "on_demand_bytes_served"
	OnDemandBytesFetched             = "on_demand_bytes_fetched"

	// logs metrics
	PrefetchTotal             = "prefetch_total"
	PrefetchDownload          = "prefetch_download"
	PrefetchDecompress        = "prefetch_decompress"
	BackgroundFetchTotal      = "background_fetch_total"
	BackgroundFetchDownload   = "background_fetch_download"
	BackgroundFetchDecompress = "background_fetch_decompress"
	PrefetchSize              = "prefetch_size"
)

Lists all metric labels.

Variables

This section is empty.

Functions

func AddBytesCount added in v0.8.0

func AddBytesCount(operation string, layer digest.Digest, bytes int64)

AddBytesCount wraps the labels attachment as well as calling Add into a single method.

func IncOperationCount added in v0.8.0

func IncOperationCount(operation string, layer digest.Digest)

IncOperationCount wraps the labels attachment as well as calling Inc into a single method.

func LogLatencyForLastOnDemandFetch added in v0.8.0

func LogLatencyForLastOnDemandFetch(ctx context.Context, layer digest.Digest, start time.Time, end time.Time)

LogLatencyForLastOnDemandFetch implements a special case for measuring the latency of last on demand fetch, which must be invoked at the end of background fetch operation only. Since this is expected to happen only once per container launch, it writes a log line, instead of directly emitting a metric. We do that in the following way: 1. We record the mount start time 2. We constantly record the timestamps when we do on demand fetch for each layer sha 3. On background fetch completed we measure the difference between the last on demand fetch and mount start time and record it as a metric

func MeasureLatency

func MeasureLatency(operation string, layer digest.Digest, start time.Time)

MeasureLatency wraps the labels attachment as well as calling Observe into a single method. Right now we attach the operation and layer digest, so it's possible to see the breakdown for latency by operation and individual layers. If you want this to be layer agnostic, just pass the digest from empty string, e.g. layerDigest := digest.FromString("")

func Register

func Register()

Register registers metrics. This is always called only once.

func WriteLatencyLogValue added in v0.8.0

func WriteLatencyLogValue(ctx context.Context, layer digest.Digest, operation string, start time.Time)

WriteLatencyLogValue wraps writing the log info record for latency in milliseconds. The log record breaks down by operation and layer digest.

func WriteLatencyWithBytesLogValue added in v0.8.0

func WriteLatencyWithBytesLogValue(ctx context.Context, layer digest.Digest, latencyOperation string, start time.Time, bytesMetricName string, bytesMetricValue int64)

WriteLatencyWithBytesLogValue wraps writing the log info record for latency in milliseconds with adding the size in bytes. The log record breaks down by operation, layer digest and byte value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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