feat: implement observability and metrics (Task 22)

- Add metrics package tracking cache hit-rate, API quota, circuit breaker trips, search time
- Integrate metrics with cache layer, yandex client, and API handlers
- Add /metrics HTTP endpoint for Prometheus-compatible metrics exposure
- Write tests for metrics functionality across cache, yandex, and API handlers
- Update test files to support new metrics infrastructure
This commit is contained in:
2026-08-17 15:27:44 +03:00
parent 5842667fff
commit c58fbb50b1
10 changed files with 285 additions and 55 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/go-redis/redis/v8"
"trip-planner/internal/cache"
"trip-planner/internal/metrics"
"trip-planner/internal/yandex"
)
@@ -19,7 +20,7 @@ func newMockMonitor(id string, tripCount int, scheduleFunc func(context.Context,
monitor := &StationMonitor{
ID: id,
Yandex: yc,
Cache: cache.NewCacheStore(rc),
Cache: cache.NewCacheStore(rc, metrics.New()),
ScheduleFunc: scheduleFunc,
}