From 0384b39f9d13aa195dd2ac5f06ce8dcb95f88621 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 12 Jul 2022 13:09:28 -0700 Subject: [PATCH] #4433: fixes to incorporate after latest merge of metrics --- exp/lighthorizon/actions/main.go | 2 +- exp/lighthorizon/index/mock_store.go | 5 +++++ exp/lighthorizon/main.go | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/exp/lighthorizon/actions/main.go b/exp/lighthorizon/actions/main.go index 68955a045c..af0a92d893 100644 --- a/exp/lighthorizon/actions/main.go +++ b/exp/lighthorizon/actions/main.go @@ -16,7 +16,7 @@ import ( var ( //go:embed static - staticFiles embed.FS + staticFiles embed.FS requestCount = promauto.NewCounter(prometheus.CounterOpts{ Name: "horizon_lite_request_count", Help: "How many requests have occurred?", diff --git a/exp/lighthorizon/index/mock_store.go b/exp/lighthorizon/index/mock_store.go index a2e7363aeb..db0e53e1cc 100644 --- a/exp/lighthorizon/index/mock_store.go +++ b/exp/lighthorizon/index/mock_store.go @@ -1,6 +1,7 @@ package index import ( + "github.com/prometheus/client_golang/prometheus" types "github.com/stellar/go/exp/lighthorizon/index/types" "github.com/stretchr/testify/mock" ) @@ -71,3 +72,7 @@ func (m *MockStore) MergeTransactions(prefix string, other *types.TrieIndex) err args := m.Called(prefix, other) return args.Error(0) } + +func (m *MockStore) RegisterMetrics(registry *prometheus.Registry) { + m.Called(registry) +} diff --git a/exp/lighthorizon/main.go b/exp/lighthorizon/main.go index 6cf4318d14..4ca2e17ffb 100644 --- a/exp/lighthorizon/main.go +++ b/exp/lighthorizon/main.go @@ -65,7 +65,7 @@ func main() { router.MethodFunc(http.MethodGet, "/operations", actions.Operations(lightHorizon)) router.MethodFunc(http.MethodGet, "/transactions", actions.Transactions(lightHorizon)) router.MethodFunc(http.MethodGet, "/", actions.ApiDocs()) - router.MethodFunc(http.MethodGet, "/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) + router.Method(http.MethodGet, "/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) log.Fatal(http.ListenAndServe(":8080", router)) }