From 00d4a8dda3c859885a885607232780d87a62fcc8 Mon Sep 17 00:00:00 2001 From: Wojtek <103407812+wojtek-coreum@users.noreply.github.com> Date: Thu, 7 Sep 2023 14:55:09 +0200 Subject: [PATCH] Turn off buggy WASM metrics (#637) # Description Due to buggy initialization of metrics collector, WASM causes panics when metrics are collected. Bug is described here: https://github.com/CosmWasm/wasmd/issues/1574 and fixed here: https://github.com/CosmWasm/wasmd/pull/1575 Once v0.42 is released we may uncomment this code. Task has been created for this. # Reviewers checklist: - [ ] Try to write more meaningful comments with clear actions to be taken. - [ ] Nit-picking should be unblocking. Focus on core issues. # Authors checklist - [x] Provide a concise and meaningful description - [x] Review the code yourself first, before making the PR. - [x] Annotate your PR in places that require explanation. - [x] Think and try to split the PR to smaller PR if it is big. --- app/app.go | 12 ++++++++---- go.mod | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index 831023fe6..4d60dbb1c 100644 --- a/app/app.go +++ b/app/app.go @@ -103,7 +103,6 @@ import ( ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibclocalhost "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost" "github.com/pkg/errors" - "github.com/prometheus/client_golang/prometheus" "github.com/spf13/cast" "github.com/CoreumFoundation/coreum/v2/app/openapi" @@ -563,9 +562,14 @@ func New( app.NFTKeeper, )), } - if cast.ToBool(appOpts.Get("telemetry.enabled")) { - wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) - } + + // FIXME (wasmd-1575): This is commented out temporarily because it causes panics in telemetry server due to buggy + // initialization of wasm vm in version v0.41 of wasmd. + // Bug has been already fixed here: https://github.com/CosmWasm/wasmd/pull/1575 + // and will be released in v0.42. + // if cast.ToBool(appOpts.Get("telemetry.enabled")) { + // wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) + // } // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks diff --git a/go.mod b/go.mod index 86fe28c20..c6b0299d1 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,6 @@ require ( github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 - github.com/prometheus/client_golang v1.16.0 github.com/samber/lo v1.38.1 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 @@ -149,6 +148,7 @@ require ( github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect