@@ -187,14 +187,7 @@ func NewGaiaApp(
187
187
logger .Debug ("successfully determined if this node is a validator" , "moniker" , vi .Moniker )
188
188
}
189
189
190
- otelConfig := gaiatelemetry.OtelConfig {
191
- Disable : cast .ToBool (appOpts .Get ("opentelemetry.disable" )),
192
- CollectorEndpoint : cast .ToString (appOpts .Get ("opentelemetry.collector-endpoint" )),
193
- CollectorMetricsURLPath : cast .ToString (appOpts .Get ("opentelemetry.collector-metrics-url-path" )),
194
- User : cast .ToString (appOpts .Get ("opentelemetry.user" )),
195
- Token : cast .ToString (appOpts .Get ("opentelemetry.token" )),
196
- PushInterval : cast .ToDuration (appOpts .Get ("opentelemetry.push-interval" )),
197
- }
190
+ otelConfig := getOtelConfig (appOpts )
198
191
app .otelClient = gaiatelemetry .NewOtelClient (otelConfig , vi )
199
192
200
193
moduleAccountAddresses := app .ModuleAccountAddrs ()
@@ -462,6 +455,25 @@ func (app *GaiaApp) BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[s
462
455
return modAccAddrs
463
456
}
464
457
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
+
465
477
// LegacyAmino returns GaiaApp's amino codec.
466
478
//
467
479
// NOTE: This is solely to be used for testing purposes as it may be desirable
0 commit comments