Skip to content

Commit 39812e6

Browse files
fix (#3821)
1 parent 5035112 commit 39812e6

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

app/app.go

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,7 @@ func NewGaiaApp(
187187
logger.Debug("successfully determined if this node is a validator", "moniker", vi.Moniker)
188188
}
189189

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)
198191
app.otelClient = gaiatelemetry.NewOtelClient(otelConfig, vi)
199192

200193
moduleAccountAddresses := app.ModuleAccountAddrs()
@@ -462,6 +455,25 @@ func (app *GaiaApp) BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[s
462455
return modAccAddrs
463456
}
464457

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+
465477
// LegacyAmino returns GaiaApp's amino codec.
466478
//
467479
// NOTE: This is solely to be used for testing purposes as it may be desirable

0 commit comments

Comments
 (0)