diff --git a/lib/netext/httpext/transport.go b/lib/netext/httpext/transport.go index 13da5bb3f254..1033f4586190 100644 --- a/lib/netext/httpext/transport.go +++ b/lib/netext/httpext/transport.go @@ -116,13 +116,16 @@ func (t *transport) measureAndEmitMetrics(unfReq *unfinishedRequest) *finishedRe } } else { urlEnabled := enabledTags.Has(stats.TagURL) - nameEnabled := enabledTags.Has(stats.TagName) - if urlEnabled || nameEnabled { + var setName bool + if _, ok := tags["name"]; !ok && enabledTags.Has(stats.TagName) { + setName = true + } + if urlEnabled || setName { cleanURL := URL{u: unfReq.request.URL, URL: unfReq.request.URL.String()}.Clean() if urlEnabled { tags["url"] = cleanURL } - if _, ok := tags["name"]; !ok && nameEnabled { + if setName { tags["name"] = cleanURL } }