Documentation ¶
Index ¶
- func ActiveUsers(ctx context.Context, registerer prometheus.Registerer, db database.Store, ...) (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 Workspaces(ctx context.Context, registerer prometheus.Registerer, db database.Store, ...) (func(), error)
- type CachedGaugeVec
- type MetricsAggregator
- type VectorOperation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveUsers ¶
func ActiveUsers(ctx context.Context, registerer prometheus.Registerer, db database.Store, duration time.Duration) (func(), error)
ActiveUsers tracks the number of users that have authenticated within the past hour.
func AgentStats ¶ added in v0.22.1
func Agents ¶ added in v0.22.1
func Agents(ctx context.Context, logger slog.Logger, registerer prometheus.Registerer, db database.Store, coordinator *atomic.Pointer[tailnet.Coordinator], derpMap *tailcfg.DERPMap, agentInactiveDisconnectTimeout, duration time.Duration) (func(), error)
Agents tracks the total number of workspaces with labels on status.
func Workspaces ¶
func Workspaces(ctx context.Context, registerer prometheus.Registerer, db database.Store, duration time.Duration) (func(), error)
Workspaces tracks the total number of workspaces with labels on status.
Types ¶
type CachedGaugeVec ¶ added in v0.22.1
type CachedGaugeVec struct {
// contains filtered or unexported fields
}
CachedGaugeVec is a wrapper for the prometheus.GaugeVec which allows for 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()" method resets the internal gauge and applies all staged changes to it.
The Use of CachedGaugeVec is recommended for use cases when there is a risk that the Prometheus collector receives incomplete metrics, collected in the middle of metrics recalculation, between "Reset()" and the last "WithLabelValues()" call.
func NewCachedGaugeVec ¶ added in v0.22.1
func NewCachedGaugeVec(gaugeVec *prometheus.GaugeVec) *CachedGaugeVec
func (*CachedGaugeVec) Collect ¶ added in v0.22.1
func (v *CachedGaugeVec) Collect(ch chan<- prometheus.Metric)
func (*CachedGaugeVec) Commit ¶ added in v0.22.1
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 expect the gauge to be empty for the next 'WithLabelValues' values.
func (*CachedGaugeVec) Describe ¶ added in v0.22.1
func (v *CachedGaugeVec) Describe(desc chan<- *prometheus.Desc)
func (*CachedGaugeVec) WithLabelValues ¶ added in v0.22.1
func (v *CachedGaugeVec) WithLabelValues(operation VectorOperation, value float64, labelValues ...string)
type MetricsAggregator ¶ added in v0.23.1
type MetricsAggregator struct {
// contains filtered or unexported fields
}
func NewMetricsAggregator ¶ added in v0.23.1
func NewMetricsAggregator(logger slog.Logger, registerer prometheus.Registerer, duration time.Duration) (*MetricsAggregator, error)
func (*MetricsAggregator) Collect ¶ added in v0.23.1
func (ma *MetricsAggregator) Collect(ch chan<- prometheus.Metric)
func (*MetricsAggregator) Describe ¶ added in v0.23.1
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 ¶ added in v0.23.1
func (ma *MetricsAggregator) Run(ctx context.Context) func()
func (*MetricsAggregator) Update ¶ added in v0.23.1
func (ma *MetricsAggregator) Update(ctx context.Context, username, workspaceName, agentName string, metrics []agentsdk.AgentMetric)
type VectorOperation ¶ added in v0.22.1
type VectorOperation int
const ( VectorOperationAdd VectorOperation = iota VectorOperationSet )