Files
PrivateCaptcha/pkg/monitoring/stub.go
Taras Kushnir 9ec1ef8d65 Refactor caching layer
Main reason being otter/v2 release with APIs for sliding expiration.

- added new cache API to use Loader logic from otter/v2 (fetch from DB)
- main direction of work is improving "negative caching" performance
  (currently it is still intertwined with the main cache)
- expose new Prometheus metric for cache hit ratio
2025-06-21 14:16:28 +03:00

32 lines
798 B
Go

package monitoring
import (
"net/http"
"github.com/PrivateCaptcha/PrivateCaptcha/pkg/common"
)
type stubMetrics struct{}
func NewStub() *stubMetrics {
return &stubMetrics{}
}
var _ common.PlatformMetrics = (*Service)(nil)
var _ common.APIMetrics = (*Service)(nil)
var _ common.PortalMetrics = (*Service)(nil)
func (sm *stubMetrics) Handler(h http.Handler) http.Handler {
return h
}
func (sm *stubMetrics) HandlerIDFunc(func() string) func(http.Handler) http.Handler {
return common.NoopMiddleware
}
func (sm *stubMetrics) ObservePuzzleCreated(userID int32) {}
func (sm *stubMetrics) ObservePuzzleVerified(userID int32, result string, isStub bool) {}
func (sm *stubMetrics) ObserveHealth(postgres, clickhouse bool) {}
func (sm *stubMetrics) ObserveCacheHitRatio(ratio float64) {}