utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsCollector

type MetricsCollector interface {
	IncrementCounter(name string, labels ...string)
	RecordHistogram(name string, value float64, labels ...string)
	RecordGauge(name string, value float64, labels ...string)
	StartTimer(name string) Timer
}

MetricsCollector defines the interface for collecting metrics. This should match the server.MetricsCollector interface.

type NoOpMetricsCollector

type NoOpMetricsCollector struct{}

NoOpMetricsCollector implements the server.MetricsCollector interface with no operations. It will be used in tests where metrics collection is not the focus. server.MetricsCollector expects:

IncrementCounter(name string, labels ...string)
RecordHistogram(name string, value float64, labels ...string)
RecordGauge(name string, value float64, labels ...string)
StartTimer(name string) server.Timer

func NewNoOpMetricsCollector

func NewNoOpMetricsCollector() *NoOpMetricsCollector

NewNoOpMetricsCollector creates a new NoOpMetricsCollector.

func (*NoOpMetricsCollector) IncrementCounter

func (c *NoOpMetricsCollector) IncrementCounter(name string, labels ...string)

IncrementCounter does nothing.

func (*NoOpMetricsCollector) RecordGauge

func (c *NoOpMetricsCollector) RecordGauge(name string, value float64, labels ...string)

RecordGauge does nothing.

func (*NoOpMetricsCollector) RecordHistogram

func (c *NoOpMetricsCollector) RecordHistogram(name string, value float64, labels ...string)

RecordHistogram does nothing.

func (*NoOpMetricsCollector) StartTimer

func (c *NoOpMetricsCollector) StartTimer(name string) server.Timer

StartTimer returns a no-op timer that satisfies server.Timer.

type Timer

type Timer interface {
	Stop() float64
}

Jump to

Keyboard shortcuts

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