Skip to content

Commit

Permalink
Update lang/ver format
Browse files Browse the repository at this point in the history
  • Loading branch information
harrryr committed Oct 14, 2024
1 parent fc991c8 commit 6acab1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions exporter/awsemfexporter/internal/useragent/useragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,15 @@ func (ua *UserAgent) Process(labels map[string]string) {
}
}

// build the user agent string from the items in the cache. Format is telemetry-sdk (<lang1>/<ver1>,<ver2>;<lang2>/<ver2>).
// build the user agent string from the items in the cache. Format is telemetry-sdk (<lang1>/<ver1>).
func (ua *UserAgent) build() {
ua.mu.Lock()
defer ua.mu.Unlock()
var items []string
for _, item := range ua.cache.Items() {
value := item.Value()
var versionStr string
for version := range value {
if versionStr != "" {
versionStr += ","
}
versionStr += version
for version := range item.Value() {
items = append(items, formatStr(item.Key(), version))
}
items = append(items, formatStr(item.Key(), versionStr))
}
ua.prebuiltStr = ""
if len(items) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions exporter/awsemfexporter/internal/useragent/useragent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func TestUserAgent(t *testing.T) {
},
},
want: []string{
"telemetry-sdk (test/1.1,1.0)",
"telemetry-sdk (test/1.0,1.1)",
"telemetry-sdk (test/1.1;test/1.0)",
"telemetry-sdk (test/1.0;test/1.1)",
},
},
"WithTruncatedAttributes": {
Expand Down

0 comments on commit 6acab1b

Please sign in to comment.