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 ¶
func Agents ¶
func Agents(ctx context.Context, logger slog.Logger, registerer prometheus.Registerer, db database.Store, coordinator *atomic.Pointer[tailnet.Coordinator], derpMapFn func() *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 ¶
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 ¶
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 expect the 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(operation VectorOperation, value float64, labelValues ...string)
type MetricsAggregator ¶
type MetricsAggregator struct {
// contains filtered or unexported fields
}
func NewMetricsAggregator ¶
func NewMetricsAggregator(logger slog.Logger, registerer prometheus.Registerer, duration time.Duration) (*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(ctx context.Context) func()
func (*MetricsAggregator) Update ¶
func (ma *MetricsAggregator) Update(ctx context.Context, username, workspaceName, agentName string, metrics []agentsdk.AgentMetric)
type VectorOperation ¶
type VectorOperation int
const ( VectorOperationAdd VectorOperation = iota VectorOperationSet )