mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 12:24:38 +03:00
expose fewer internals in packages, for easier software reuse
- prometheus is now behind an interface, they aren't dependencies for the reusable components anymore. - some dependencies have been inverted: instead of packages importing a main package to get configuration, the main package now sets configuration in these packages. that means fewer internals are pulled in. - some functions now have new parameters for values that were retrieved from package "mox-".
This commit is contained in:
43
stub/metrics.go
Normal file
43
stub/metrics.go
Normal file
@ -0,0 +1,43 @@
|
||||
package stub
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
func HTTPClientObserveIgnore(ctx context.Context, log *slog.Logger, pkg, method string, statusCode int, err error, start time.Time) {
|
||||
}
|
||||
|
||||
type Counter interface {
|
||||
Inc()
|
||||
}
|
||||
|
||||
type CounterIgnore struct{}
|
||||
|
||||
func (CounterIgnore) Inc() {}
|
||||
|
||||
type CounterVec interface {
|
||||
IncLabels(labels ...string)
|
||||
}
|
||||
|
||||
type CounterVecIgnore struct{}
|
||||
|
||||
func (CounterVecIgnore) IncLabels(labels ...string) {}
|
||||
|
||||
type Histogram interface {
|
||||
Observe(float64)
|
||||
}
|
||||
|
||||
type HistogramIgnore struct{}
|
||||
|
||||
func (HistogramIgnore) Observe(float64) {}
|
||||
|
||||
type HistogramVec interface {
|
||||
ObserveLabels(v float64, labels ...string)
|
||||
}
|
||||
|
||||
type HistogramVecIgnore struct{}
|
||||
|
||||
func (HistogramVecIgnore) ObserveLabels(v float64, labels ...string) {}
|
Reference in New Issue
Block a user