Skip to content

Commit

Permalink
chore: simplify request tracing middleware setup logic (#1511)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?

:wave: Consolidate the middleware setup logic for request tracing.
Instead of separate conditions, use a single one.
  • Loading branch information
LashaJini authored Apr 2, 2024
1 parent bf8350f commit 8243e35
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ func NewAPIWithVersion(ctx context.Context, globalConfig *conf.GlobalConfigurati
r := newRouter()
r.Use(addRequestID(globalConfig))

// request tracing should be added only when tracing or metrics is
// enabled
if globalConfig.Tracing.Enabled {
r.UseBypass(observability.RequestTracing())
} else if globalConfig.Metrics.Enabled {
// request tracing should be added only when tracing or metrics is enabled
if globalConfig.Tracing.Enabled || globalConfig.Metrics.Enabled {
r.UseBypass(observability.RequestTracing())
}

Expand Down

0 comments on commit 8243e35

Please sign in to comment.