Skip to content

Commit

Permalink
Initialising Tracing irrespective of configs (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
coolwednesday authored Oct 4, 2024
1 parent 37891d1 commit 403c2a0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/gofr/gofr.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,6 @@ func (a *App) Migrate(migrationsMap map[int64]migration.Migrate) {
}

func (a *App) initTracer() {
traceExporter := a.Config.Get("TRACE_EXPORTER")
tracerURL := a.Config.Get("TRACER_URL")

// deprecated : tracer_host and tracer_port are deprecated and will be removed in upcoming versions.
tracerHost := a.Config.Get("TRACER_HOST")
tracerPort := a.Config.GetOrDefault("TRACER_PORT", "9411")

if !isValidConfig(a.Logger(), traceExporter, tracerURL, tracerHost, tracerPort) {
return
}

traceRatio, err := strconv.ParseFloat(a.Config.GetOrDefault("TRACER_RATIO", "1"), 64)
if err != nil {
a.container.Error(err)
Expand All @@ -412,6 +401,17 @@ func (a *App) initTracer() {
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
otel.SetErrorHandler(&otelErrorHandler{logger: a.container.Logger})

traceExporter := a.Config.Get("TRACE_EXPORTER")
tracerURL := a.Config.Get("TRACER_URL")

// deprecated : tracer_host and tracer_port are deprecated and will be removed in upcoming versions.
tracerHost := a.Config.Get("TRACER_HOST")
tracerPort := a.Config.GetOrDefault("TRACER_PORT", "9411")

if !isValidConfig(a.Logger(), traceExporter, tracerURL, tracerHost, tracerPort) {
return
}

exporter, err := a.getExporter(traceExporter, tracerHost, tracerPort, tracerURL)

if err != nil {
Expand Down

0 comments on commit 403c2a0

Please sign in to comment.