metrics

package
v0.0.0-...-21dd264 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionPoolUsageResultHit     = "hit"
	ConnectionPoolUsageResultMiss    = "miss"
	ConnectionPoolUsageResultTimeout = "timeout"

	ConnectionPoolConnectionStateIdle   = "idle"
	ConnectionPoolConnectionStateActive = "active"

	EnvMetricsRecordingIntervalSeconds = "metrics_recording_interval_seconds"
)

Variables

View Source
var (
	// KeyConnectionShard is used to differentiate between each connection shard, as our client shards the
	// usage across multiple Redis servers based on hashing keys.
	KeyConnectionShard = tag.MustNewKey("connection_shard")

	// MMemoryStoreConnectionPoolUsage is used to track the connection pool's usage (hits, misses, timeouts).
	MMemoryStoreConnectionPoolUsage = stats.Int64("memorystore/redis_connection_pool_usage",
		"Redis client connection pool usage statistics", "")

	// KeyPoolUsageResult is used to group pool accesses by the result (hit, miss, or timeout).
	KeyPoolUsageResult = tag.MustNewKey("usage_result")

	// MMemoryStoreConnectionPoolConnections is used to track the connection pool's number of connections
	// to the Redis server, and the state of that connection (idle, active).
	MMemoryStoreConnectionPoolConnections = stats.Int64("memorystore/redis_connection_pool",
		"Redis client connection pool connection statistics", "")

	// KeyPoolConnState is used to group metrics by state (e.g. idle, stale, etc.)
	KeyPoolConnState = tag.MustNewKey("state")
)

Functions

func GetMetricsRecordingInterval

func GetMetricsRecordingInterval() time.Duration

GetMetricsRecordingInterval returns the intended time between recording intervals for gathering metrics. The actual reporting interval is controlled by the exporter (if implemented elsewhere).

func ParseRecordingIntervalFromEnvironment

func ParseRecordingIntervalFromEnvironment()

ParseRecordingIntervalFromEnvironment will attempt to read the environment variable and update the metricsRecordingInterval exported by GetMetricsRecordingInterval. Should be called by Init() and test functions only.

func RecordWithTagName

func RecordWithTagName(ctx context.Context, measurement stats.Measurement, key tag.Key, name string)

RecordWithTagName is a convenience method for recording a metric with a given tag and name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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