Skip to content

Commit

Permalink
Rename name and nameChanged
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Oct 7, 2024
1 parent 910c63c commit 45b6cd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions common/network_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ func (m *NetworkManager) emitResponseMetrics(resp *Response, req *Request) {
// against user supplied regex. If there's a match a user supplied name will
// be used instead of the url for the url tag, otherwise the url will be used.
func handleURLTag(ctx context.Context, mi metricInterceptor, url string, tags *k6metrics.TagSet) *k6metrics.TagSet {
if name, ok := mi.urlTagName(ctx, url); ok {
tags = tags.With("url", name)
tags = tags.With("name", name)
if newTagName, urlMatched := mi.urlTagName(ctx, url); urlMatched {
tags = tags.With("url", newTagName)
tags = tags.With("name", newTagName)
return tags
}

Expand Down
12 changes: 6 additions & 6 deletions common/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ func (p *Page) urlTagName(ctx context.Context, urlTag string) (string, bool) {
return "", false
}

var name string
var nameChanged bool
var newTagName string
var urlMatched bool
em := &MetricEvent{
urlTag: urlTag,
}
Expand All @@ -401,13 +401,13 @@ func (p *Page) urlTagName(ctx context.Context, urlTag string) (string, bool) {

// If a match was found then the name field in em will have been updated.
if em.name != nil {
name = *em.name
nameChanged = true
newTagName = *em.name
urlMatched = true
}

p.logger.Debugf("urlTagName", "name: %q nameChanged: %v", name, nameChanged)
p.logger.Debugf("urlTagName", "name: %q nameChanged: %v", newTagName, urlMatched)

return name, nameChanged
return newTagName, urlMatched
}

// MetricEvent is the type that is exported to JS. It is currently only used to
Expand Down

0 comments on commit 45b6cd5

Please sign in to comment.