prometheusmetrics
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Variables
- func ActiveUsers(ctx context.Context, logger slog.Logger, registerer prometheus.Registerer, ...) (func(), error)
- func AgentStats(ctx context.Context, logger slog.Logger, registerer prometheus.Registerer, ...) (func(), error)
- func Agents(ctx context.Context, logger slog.Logger, registerer prometheus.Registerer, ...) (func(), error)
- func Experiments(registerer prometheus.Registerer, active codersdk.Experiments) error
- func Users(ctx context.Context, logger slog.Logger, clk quartz.Clock, ...) (func(), error)
- func Workspaces(ctx context.Context, logger slog.Logger, registerer prometheus.Registerer, ...) (func(), error)
- type AgentMetricLabels
- type CachedGaugeVec
- type MetricsAggregator
- type VectorOperation
Constants¶
This section is empty.
Variables¶
var MetricLabelValueEncoder =strings.NewReplacer("\\", "\\\\", "|", "\\|", ",", "\\,", "=", "\\=")
Functions¶
funcActiveUsers¶
func ActiveUsers(ctxcontext.Context, loggerslog.Logger, registererprometheus.Registerer, dbdatabase.Store, durationtime.Duration) (func(),error)
ActiveUsers tracks the number of users that have authenticated within the past hour.
funcAgentStats¶
func AgentStats(ctxcontext.Context, loggerslog.Logger, registererprometheus.Registerer, dbdatabase.Store, initialCreateAftertime.Time, durationtime.Duration, aggregateByLabels []string, usagebool) (func(),error)
nolint:revive // This will be removed alongside the workspaceusage experiment
funcAgents¶
func Agents(ctxcontext.Context, loggerslog.Logger, registererprometheus.Registerer, dbdatabase.Store, coordinator *atomic.Pointer[tailnet.Coordinator], derpMapFn func() *tailcfg.DERPMap, agentInactiveDisconnectTimeout, durationtime.Duration) (func(),error)
Agents tracks the total number of workspaces with labels on status.
funcExperiments¶added inv2.10.0
func Experiments(registererprometheus.Registerer, activecodersdk.Experiments)error
Experiments registers a metric which indicates whether each experiment is enabled or not.
funcUsers¶added inv2.17.0
func Users(ctxcontext.Context, loggerslog.Logger, clkquartz.Clock, registererprometheus.Registerer, dbdatabase.Store, durationtime.Duration) (func(),error)
Users tracks the total number of registered users, partitioned by status.
funcWorkspaces¶
func Workspaces(ctxcontext.Context, loggerslog.Logger, registererprometheus.Registerer, dbdatabase.Store, durationtime.Duration) (func(),error)
Workspaces tracks the total number of workspaces with labels on status.
Types¶
typeAgentMetricLabels¶added inv2.5.1
AgentMetricLabels are the labels used to decorate an agent's metrics.This list should match the list of labels in agentMetricsLabels.
typeCachedGaugeVec¶
type CachedGaugeVec struct {// contains filtered or unexported fields}
CachedGaugeVec is a wrapper for the prometheus.GaugeVec which allowsfor staging changes in the metrics vector. Calling "WithLabelValues(...)"will update the internal gauge value, but it will not be returned by"Collect(...)" until the "Commit()" method is called. The "Commit()" methodresets the internal gauge and applies all staged changes to it.
The Use of CachedGaugeVec is recommended for use cases when there is a riskthat the Prometheus collector receives incomplete metrics, collectedin the middle of metrics recalculation, between "Reset()" and the last"WithLabelValues()" call.
funcNewCachedGaugeVec¶
func NewCachedGaugeVec(gaugeVec *prometheus.GaugeVec) *CachedGaugeVec
func (*CachedGaugeVec)Collect¶
func (v *CachedGaugeVec) Collect(ch chan<-prometheus.Metric)
func (*CachedGaugeVec)Commit¶
func (v *CachedGaugeVec) Commit()
Commit will set the internal value as the cached value to return from "Collect()".The internal metric value is completely reset, so the caller should expectthe gauge to be empty for the next 'WithLabelValues' values.
func (*CachedGaugeVec)Describe¶
func (v *CachedGaugeVec) Describe(desc chan<- *prometheus.Desc)
func (*CachedGaugeVec)WithLabelValues¶
func (v *CachedGaugeVec) WithLabelValues(operationVectorOperation, valuefloat64, labelValues ...string)
typeMetricsAggregator¶
type MetricsAggregator struct {// contains filtered or unexported fields}
funcNewMetricsAggregator¶
func NewMetricsAggregator(loggerslog.Logger, registererprometheus.Registerer, durationtime.Duration, aggregateByLabels []string) (*MetricsAggregator,error)
func (*MetricsAggregator)Collect¶
func (ma *MetricsAggregator) Collect(ch chan<-prometheus.Metric)
func (*MetricsAggregator)Describe¶
func (*MetricsAggregator) Describe(_ chan<- *prometheus.Desc)
Describe function does not have any knowledge about the metrics schema,so it does not emit anything.
func (*MetricsAggregator)Run¶
func (ma *MetricsAggregator) Run(ctxcontext.Context) func()
func (*MetricsAggregator)Update¶
func (ma *MetricsAggregator) Update(ctxcontext.Context, labelsAgentMetricLabels, metrics []*agentproto.Stats_Metric)
typeVectorOperation¶
type VectorOperationint
const (VectorOperationAddVectorOperation =iotaVectorOperationSet)