metrics

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRPCMethodKey  = "grpc_method"
	GRPCServiceKey = "grpc_service"
	StatementKey   = "stmt" // either exec or query
	ExecStatement  = "exec"
	QueryStatement = "query"

	StrategyKey = "strategy"
	PathKey     = "path"
	UrlKey      = "url"
)
View Source
const (
	PathChksumMetricsEnableEnvVar = "HOTLOAD_PATH_CHKSUM_METRICS_ENABLE"
)

Variables

View Source
var (
	ErrDuplicatePath = errors.New("duplicate path")
	ErrPathNotFound  = errors.New("path not found")

	HotloadPathChksumTimestampSecondsName         = "hotload_path_chksum_timestamp_seconds"
	HotloadPathChksumTimestampSecondsHelp         = "Hotload path checksum last changed (unix timestamp), by path"
	HotloadPathChksumTimestampSecondsGaugeFuncVec = gaugefuncvec.New(prometheus.GaugeOpts{
		Name: HotloadPathChksumTimestampSecondsName,
		Help: HotloadPathChksumTimestampSecondsHelp,
	}, []string{PathKey})
)
View Source
var ExpectHotloadPathChksumTimestampSecondsPreamble = `` /* 233-byte string literal not displayed */
View Source
var ExpectHotloadPathChksumTimestampSecondsRegexp = `                                                             
hotload_path_chksum_timestamp_seconds{path="%s"} \d\.\d+e\+\d+`
View Source
var HotloadChangeTotalHelp = "Hotload change total by url"
View Source
var HotloadChangeTotalName = "hotload_change_total"

HotloadChangeTotal is count of changes detected by hotload

View Source
var HotloadLastChangedTimestampSecondsHelp = "Hotload last changed (unix timestamp), by url"
View Source
var HotloadLastChangedTimestampSecondsName = "hotload_last_changed_timestamp_seconds"

HotloadLastChangedTimestampSeconds is timestamp when hotload last detected change (unix timestamp)

View Source
var HotloadModtimeLatencyHistogramDefBuckets = []float64{900, 1800, 2700, 3600, 4500, 5400, 7200, 10800, 14400, 28800, 86400}
View Source
var HotloadModtimeLatencyHistogramHelp = "Hotload modtime latency histogram (seconds) by strategy and path"
View Source
var HotloadModtimeLatencyHistogramName = "hotload_modtime_latency_histogram"

HotloadModtimeLatencyHistogram is modtime latency histogram (in seconds) ie: each sample datapoint is time.Now().Sub(Modtime)

View Source
var SqlStmtsSummary = prometheus.NewSummaryVec(prometheus.SummaryOpts{
	Name: SqlStmtsSummaryName,
	Help: "The number of sql stmts called in a transaction by statement type per grpc service and method",
}, []string{GRPCServiceKey, GRPCMethodKey, StatementKey})
View Source
var SqlStmtsSummaryName = "transaction_sql_stmts"

SqlStmtsSummary is a prometheus metric to keep track of the number of times a sql statement is called in a transaction by statement type per grpc service

Functions

func AddToDefaultPathChksum added in v1.7.3

func AddToDefaultPathChksum(pathStr string) error

AddToDefaultPathChksum adds a path to the global defaultPathChksum for checksum metrics

func CleanPath added in v1.7.3

func CleanPath(pathStr string) string

CleanPath cleans and trimspaces path strings

func DefaultFileHasher added in v1.7.3

func DefaultFileHasher(filePath string) (uint64, error)

DefaultFileHasher hashes file contents using CRC64

func GetCollectors

func GetCollectors() []prometheus.Collector

func IncHotloadChangeTotal added in v1.7.0

func IncHotloadChangeTotal(url string)

func ObserveHotloadModtimeLatencyHistogram

func ObserveHotloadModtimeLatencyHistogram(strategy, path string, val float64)

func ResetCollectors

func ResetCollectors()

ResetCollectors is useful for testing

func SetHotloadLastChangedTimestampSeconds added in v1.7.2

func SetHotloadLastChangedTimestampSeconds(url string, val float64)

Types

type FileHasher added in v1.7.3

type FileHasher func(filePath string) (uint64, error)

Define FileHasher type so we can mock it for unit-testing

Jump to

Keyboard shortcuts

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