Skip to content

Commit

Permalink
Sort source names
Browse files Browse the repository at this point in the history
Sort the list of source names to make the label value consistent.
* Bump time Go mod.

Fixes: #25

Signed-off-by: SuperQ <superq@gmail.com>
  • Loading branch information
SuperQ committed Jul 1, 2023
1 parent c14368f commit aae44d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions collector/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"math"
"net"
"sort"
"strings"

"github.com/facebook/time/ntp/chrony"
Expand Down Expand Up @@ -122,6 +123,7 @@ func (e Exporter) getSourcesMetrics(ch chan<- prometheus.Metric, client chrony.C
sourceAddress := r.IPAddr.String()
// Ignore reverse lookup errors.
sourceNames, _ := net.LookupAddr(sourceAddress)
sort.Strings(sourceNames)
sourceName := strings.Join(sourceNames, ",")

if r.Mode == chrony.SourceModeRef && r.IPAddr.To4() != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/alecthomas/kingpin/v2 v2.3.2
github.com/facebook/time v0.0.0-20230328101046-54fdb4d16625
github.com/facebook/time v0.0.0-20230529151911-512b3b30ab23
github.com/go-kit/log v0.2.1
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/common v0.44.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/facebook/time v0.0.0-20230328101046-54fdb4d16625 h1:n9sqA4q62V8p3b7hcotw23eP1k3KETSJpJdO6uzPYCk=
github.com/facebook/time v0.0.0-20230328101046-54fdb4d16625/go.mod h1:dfouHrgxDA7FxAzPYOFIGHFcrFlG2trLpeLtA5+hs+Q=
github.com/facebook/time v0.0.0-20230529151911-512b3b30ab23 h1:2bNmQUpwOmOwPrUFts4znQaefE8fYMzf3yutKzWztWM=
github.com/facebook/time v0.0.0-20230529151911-512b3b30ab23/go.mod h1:dfouHrgxDA7FxAzPYOFIGHFcrFlG2trLpeLtA5+hs+Q=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
Expand Down

0 comments on commit aae44d4

Please sign in to comment.