Skip to content

Commit

Permalink
open-telemetry#21715 - review comments - sort dimensions strings befo…
Browse files Browse the repository at this point in the history
…re hasing
  • Loading branch information
rajim17 committed May 19, 2023
1 parent 6a187bc commit 856b74b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions receiver/azuremonitorreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"crypto/sha256"
"fmt"
"sort"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -80,6 +81,7 @@ type metricsCompositeKey struct {
func (s metricsCompositeKey) Hash() string {
h := sha256.New()
h.Write([]byte(s.timeGrain))
sort.Strings(s.dimensions)
h.Write([]byte(strings.Join(s.dimensions, ",")))
return string(h.Sum(nil))
}
Expand Down

0 comments on commit 856b74b

Please sign in to comment.