Skip to content

Commit b312417

Browse files
authored
remove telemetry module (#3922)
1 parent d941ff4 commit b312417

22 files changed

Lines changed: 14 additions & 4467 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## UNRELEASED
44

55
### FEATURES
6-
- Add OpenTelemetry metrics ([\#3805](https://github.com/cosmos/gaia/pull/3805))
6+
77

88
### DEPENDENCIES
99
- Bump [go.opentelemetry.io/otel/sdk/metric](https://github.com/open-telemetry/opentelemetry-go) from 1.36.0 to 1.37.0 ([#3820](https://github.com/cosmos/gaia/pull/3820))

Makefile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -469,18 +469,6 @@ proto-update-deps:
469469

470470
.PHONY: proto-all proto-gen proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps
471471

472-
###############################################################################
473-
### Open Telemetry ###
474-
###############################################################################
475-
476-
start-telemetry-server:
477-
cd contrib/telemetry && docker compose up -d
478-
479-
stop-telemetry-server:
480-
cd contrib/telemetry && docker compose down --remove-orphans
481-
482-
.PHONY: start-telemetry-server stop-telemetry-server
483-
484472
###############################################################################
485473
### Localnet ###
486474
###############################################################################

app/app.go

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ import (
1111
"github.com/gorilla/mux"
1212
"github.com/rakyll/statik/fs"
1313
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"
14-
"github.com/spf13/cast"
15-
"github.com/spf13/viper"
1614

1715
abci "github.com/cometbft/cometbft/abci/types"
18-
tmcfg "github.com/cometbft/cometbft/config"
1916
tmjson "github.com/cometbft/cometbft/libs/json"
20-
"github.com/cometbft/cometbft/privval"
2117
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
2218

2319
dbm "github.com/cosmos/cosmos-db"
@@ -41,7 +37,6 @@ import (
4137

4238
"github.com/cosmos/cosmos-sdk/baseapp"
4339
"github.com/cosmos/cosmos-sdk/client"
44-
"github.com/cosmos/cosmos-sdk/client/flags"
4540
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
4641
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
4742
"github.com/cosmos/cosmos-sdk/codec"
@@ -66,7 +61,6 @@ import (
6661
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
6762
txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
6863
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
69-
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
7064
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
7165
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
7266

@@ -78,8 +72,6 @@ import (
7872
"github.com/cosmos/gaia/v26/app/keepers"
7973
"github.com/cosmos/gaia/v26/app/upgrades"
8074
v260 "github.com/cosmos/gaia/v26/app/upgrades/v26_0_0"
81-
gaiatelemetry "github.com/cosmos/gaia/v26/telemetry"
82-
"github.com/cosmos/gaia/v26/x/telemetry"
8375
)
8476

8577
var (
@@ -114,8 +106,6 @@ type GaiaApp struct { //nolint: revive
114106
// simulation manager
115107
sm *module.SimulationManager
116108
configurator module.Configurator
117-
118-
otelClient *gaiatelemetry.OtelClient
119109
}
120110

121111
func init() {
@@ -180,16 +170,6 @@ func NewGaiaApp(
180170
interfaceRegistry: interfaceRegistry,
181171
}
182172

183-
vi, err := getValidatorInfo(homePath, appOpts)
184-
if err != nil {
185-
logger.Debug("failed to get validator info: unable to determine if this node is a validator", "err", err)
186-
} else {
187-
logger.Debug("successfully determined if this node is a validator", "moniker", vi.Moniker)
188-
}
189-
190-
otelConfig := getOtelConfig(appOpts)
191-
app.otelClient = gaiatelemetry.NewOtelClient(otelConfig, vi)
192-
193173
moduleAccountAddresses := app.ModuleAccountAddrs()
194174

195175
// Setup keepers
@@ -241,7 +221,6 @@ func NewGaiaApp(
241221
app.mm.SetOrderPreBlockers(
242222
upgradetypes.ModuleName,
243223
authtypes.ModuleName,
244-
telemetry.ModuleName,
245224
)
246225
// During begin block slashing happens after distr.BeginBlocker so that
247226
// there is nothing left over in the validator fee pool, so as to keep the
@@ -379,15 +358,6 @@ func NewGaiaApp(
379358
}
380359
}
381360

382-
if otelConfig.CollectorEndpoint != "" && !otelConfig.Disable {
383-
logger.Debug("creating gaia app with open telemetry")
384-
if err := app.otelClient.StartExporter(logger); err != nil {
385-
panic(err)
386-
}
387-
} else {
388-
logger.Debug("creating gaia app without open telemetry")
389-
}
390-
391361
return app
392362
}
393363

@@ -455,25 +425,6 @@ func (app *GaiaApp) BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[s
455425
return modAccAddrs
456426
}
457427

458-
func getOtelConfig(appOpts servertypes.AppOptions) gaiatelemetry.OtelConfig {
459-
// if appOpts.Get yields nil, this value was not set.
460-
// since the user isn't making any intent to disable here, we will use the DefaultOtelConfig.
461-
disableRaw := appOpts.Get("opentelemetry.disable")
462-
if disableRaw == nil {
463-
return gaiatelemetry.DefaultOtelConfig
464-
}
465-
// if disableRaw wasn't nil, the user is making the intent to use their config. so we will use their values.
466-
otelConfig := gaiatelemetry.OtelConfig{
467-
Disable: cast.ToBool(appOpts.Get("opentelemetry.disable")),
468-
CollectorEndpoint: cast.ToString(appOpts.Get("opentelemetry.collector-endpoint")),
469-
CollectorMetricsURLPath: cast.ToString(appOpts.Get("opentelemetry.collector-metrics-url-path")),
470-
User: cast.ToString(appOpts.Get("opentelemetry.user")),
471-
Token: cast.ToString(appOpts.Get("opentelemetry.token")),
472-
PushInterval: cast.ToDuration(appOpts.Get("opentelemetry.push-interval")),
473-
}
474-
return otelConfig
475-
}
476-
477428
// LegacyAmino returns GaiaApp's amino codec.
478429
//
479430
// NOTE: This is solely to be used for testing purposes as it may be desirable
@@ -616,48 +567,6 @@ func (app *GaiaApp) AutoCliOpts() autocli.AppOptions {
616567
}
617568
}
618569

619-
func getValidatorInfo(homePath string, appOpts servertypes.AppOptions) (gaiatelemetry.ValidatorInfo, error) {
620-
cfg := &tmcfg.Config{
621-
BaseConfig: tmcfg.BaseConfig{},
622-
RPC: &tmcfg.RPCConfig{},
623-
P2P: &tmcfg.P2PConfig{},
624-
Mempool: &tmcfg.MempoolConfig{},
625-
StateSync: &tmcfg.StateSyncConfig{},
626-
BlockSync: &tmcfg.BlockSyncConfig{},
627-
Consensus: &tmcfg.ConsensusConfig{},
628-
Storage: &tmcfg.StorageConfig{},
629-
TxIndex: &tmcfg.TxIndexConfig{},
630-
Instrumentation: &tmcfg.InstrumentationConfig{},
631-
}
632-
cfg.SetRoot(homePath)
633-
634-
configPath := filepath.Join(homePath, "config", "config.toml")
635-
if _, err := os.Stat(configPath); err == nil {
636-
viper := viper.New()
637-
viper.SetConfigType("toml")
638-
viper.SetConfigFile(configPath)
639-
if err := viper.ReadInConfig(); err == nil {
640-
if err := viper.Unmarshal(cfg); err != nil {
641-
return gaiatelemetry.ValidatorInfo{}, fmt.Errorf("failed to unmarshal config file: %w", err)
642-
}
643-
}
644-
} else {
645-
return gaiatelemetry.ValidatorInfo{}, fmt.Errorf("unable to stat config file at %s", configPath)
646-
}
647-
648-
chainID := cast.ToString(appOpts.Get(flags.FlagChainID))
649-
if chainID == "" {
650-
genDocFile := filepath.Join(homePath, "config", "genesis.json")
651-
appGenesis, err := genutiltypes.AppGenesisFromFile(genDocFile)
652-
if err == nil {
653-
chainID = appGenesis.ChainID
654-
}
655-
}
656-
657-
vi, err := validatorInfoFromCometConfig(cfg, chainID)
658-
return vi, err
659-
}
660-
661570
// TestingApp functions
662571

663572
// GetBaseApp implements the TestingApp interface.
@@ -724,41 +633,3 @@ func minTxFeesChecker(ctx sdk.Context, tx sdk.Tx, feemarketKp feemarketkeeper.Ke
724633

725634
return feeTx.GetFee(), 0, nil
726635
}
727-
728-
var ErrNotValidator = fmt.Errorf("not validator")
729-
730-
func validatorInfoFromCometConfig(cfg *tmcfg.Config, chainID string) (gaiatelemetry.ValidatorInfo, error) {
731-
vi := gaiatelemetry.ValidatorInfo{
732-
ChainID: chainID,
733-
}
734-
if cfg.PrivValidatorListenAddr != "" {
735-
listenAddr := cfg.PrivValidatorListenAddr
736-
pve, err := privval.NewSignerListener(listenAddr, nil)
737-
if err != nil {
738-
return vi, fmt.Errorf("failed to start private validator: %w", err)
739-
}
740-
741-
pvsc, err := privval.NewSignerClient(pve, chainID)
742-
if err != nil {
743-
return vi, fmt.Errorf("failed to start private validator: %w", err)
744-
}
745-
746-
pk, err := pvsc.GetPubKey()
747-
if err != nil {
748-
return vi, fmt.Errorf("cannot get pubkey from remote signer: %w", err)
749-
}
750-
vi.Moniker = cfg.Moniker
751-
vi.Address = pk.Address()
752-
return vi, nil
753-
} else if cfg.PrivValidatorKey != "" {
754-
vi.Moniker = cfg.Moniker
755-
_, err := os.Stat(cfg.PrivValidatorKeyFile())
756-
if err != nil {
757-
return vi, ErrNotValidator
758-
}
759-
pv := privval.LoadFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
760-
vi.Address = pv.GetAddress()
761-
return vi, nil
762-
}
763-
return vi, ErrNotValidator
764-
}

app/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ import (
44
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
55

66
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
7-
8-
"github.com/cosmos/gaia/v26/telemetry"
97
)
108

119
type AppConfig struct {
1210
serverconfig.Config
1311

1412
Wasm wasmtypes.NodeConfig `mapstructure:"wasm"`
15-
16-
OpenTelemetry telemetry.OtelConfig `mapstructure:"opentelemetry"`
1713
}

app/modules.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import (
5454
"github.com/cosmos/cosmos-sdk/x/slashing"
5555
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
5656
"github.com/cosmos/cosmos-sdk/x/staking"
57-
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
5857
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
5958

6059
"github.com/CosmWasm/wasmd/x/wasm"
@@ -64,7 +63,6 @@ import (
6463
liquidtypes "github.com/cosmos/gaia/v26/x/liquid/types"
6564
"github.com/cosmos/gaia/v26/x/metaprotocols"
6665
metaprotocolstypes "github.com/cosmos/gaia/v26/x/metaprotocols/types"
67-
"github.com/cosmos/gaia/v26/x/telemetry"
6866
)
6967

7068
var maccPerms = map[string][]string{
@@ -122,7 +120,6 @@ func appModules(
122120
feemarket.NewAppModule(appCodec, *app.FeeMarketKeeper),
123121
tendermint.NewAppModule(tmLightClientModule),
124122
liquid.NewAppModule(appCodec, app.LiquidKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
125-
telemetry.NewAppModule(&stakingkeeper.Querier{Keeper: app.StakingKeeper}, app.otelClient),
126123
}
127124
}
128125

cmd/gaiad/cmd/root.go

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import (
5757
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
5858

5959
gaia "github.com/cosmos/gaia/v26/app"
60-
"github.com/cosmos/gaia/v26/telemetry"
6160
)
6261

6362
// NewRootCmd creates a new root command for simd. It is called once in the
@@ -138,23 +137,7 @@ func NewRootCmd() *cobra.Command {
138137
customAppTemplate, customAppConfig := initAppConfig()
139138
customCometConfig := initCometConfig()
140139

141-
err = server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCometConfig)
142-
if err != nil {
143-
return err
144-
}
145-
146-
// if open telemetry is not disabled, we force the SDK telemetry to be enabled.
147-
serverCtx := server.GetServerContextFromCmd(cmd)
148-
if !serverCtx.Viper.GetBool("opentelemetry.disable") {
149-
serverCtx.Config.Instrumentation.Prometheus = true
150-
serverCtx.Viper.Set("telemetry.enabled", true)
151-
serverCtx.Viper.Set("telemetry.prometheus-retention-time", 60)
152-
if err := server.SetCmdServerContext(cmd, serverCtx); err != nil {
153-
return fmt.Errorf("could not set cmd server context: %w", err)
154-
}
155-
}
156-
157-
return nil
140+
return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCometConfig)
158141
},
159142
}
160143

@@ -197,18 +180,13 @@ func initAppConfig() (string, interface{}) {
197180
srvCfg := serverconfig.DefaultConfig()
198181
srvCfg.StateSync.SnapshotInterval = 1000
199182
srvCfg.StateSync.SnapshotKeepRecent = 10
200-
srvCfg.Telemetry.Enabled = true
201-
if srvCfg.Telemetry.PrometheusRetentionTime <= 0 {
202-
srvCfg.Telemetry.PrometheusRetentionTime = 60
203-
}
204183

205184
customAppConfig := gaia.AppConfig{
206-
Config: *srvCfg,
207-
Wasm: wasmtypes.DefaultNodeConfig(),
208-
OpenTelemetry: telemetry.DefaultOtelConfig,
185+
Config: *srvCfg,
186+
Wasm: wasmtypes.DefaultNodeConfig(),
209187
}
210188

211-
defaultAppTemplate := serverconfig.DefaultConfigTemplate + wasmtypes.DefaultConfigTemplate() + telemetry.OpenTelemetryTemplate()
189+
defaultAppTemplate := serverconfig.DefaultConfigTemplate + wasmtypes.DefaultConfigTemplate()
212190

213191
return defaultAppTemplate, customAppConfig
214192
}

cmd/gaiad/cmd/testnet.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import (
4747
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
4848

4949
gaia "github.com/cosmos/gaia/v26/app"
50-
"github.com/cosmos/gaia/v26/telemetry"
5150
)
5251

5352
var (
@@ -247,15 +246,10 @@ func initTestnetFiles(
247246
serverCfg.Telemetry.PrometheusRetentionTime = 60
248247
serverCfg.Telemetry.EnableHostnameLabel = false
249248
serverCfg.Telemetry.GlobalLabels = [][]string{{"chain_id", args.chainID}}
250-
otelConfig := telemetry.LocalOtelConfig
251-
if args.useDocker {
252-
// if useDocker, we need to use the docker networking. localhost is troublesome in the setup.
253-
otelConfig.CollectorEndpoint = "host.docker.internal:4318"
254-
}
249+
255250
gaiaCfg := gaia.AppConfig{
256-
Config: *serverCfg,
257-
Wasm: wasmtypes.NodeConfig{},
258-
OpenTelemetry: otelConfig,
251+
Config: *serverCfg,
252+
Wasm: wasmtypes.NodeConfig{},
259253
}
260254

261255
var (

contrib/telemetry/docker-compose.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)