Movatterモバイル変換


[0]ホーム

URL:


prometheusmetrics

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:24Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

funcExperimentsadded inv2.10.0

func Experiments(registererprometheus.Registerer, activecodersdk.Experiments)error

Experiments registers a metric which indicates whether each experiment is enabled or not.

funcUsersadded 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

typeAgentMetricLabelsadded inv2.5.1

type AgentMetricLabels struct {UsernamestringWorkspaceNamestringAgentNamestringTemplateNamestring}

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

typeVectorOperation

type VectorOperationint
const (VectorOperationAddVectorOperation =iotaVectorOperationSet)

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp