Skip to content

Commit

Permalink
Introduce hashicorp/go-metrics compatibility
Browse files Browse the repository at this point in the history
Compatability is attained with build tags

Using tag armonmetrics or no tag at all will result in the library utilizing github.com/armon/go-metrics for metrics emission

Using tag hashicorpmetrics will result in the library utilizing the updated github.com/hashicorp/go-metrics for metrics emission.
  • Loading branch information
mkeeler committed Dec 18, 2024
1 parent 5af4428 commit 167b9d0
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 16 deletions.
2 changes: 1 addition & 1 deletion awareness.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/go-metrics/compat"
)

// awareness manages a simple metric for tracking the estimated health of the
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"strings"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/go-metrics/compat"
"github.com/hashicorp/go-multierror"
)

Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@ module github.com/hashicorp/memberlist
go 1.20

require (
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
github.com/hashicorp/go-metrics v0.5.4-0.20241111182750-ceaacca141e7
github.com/hashicorp/go-msgpack/v2 v2.1.1
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-sockaddr v1.0.0
github.com/miekg/dns v1.1.26
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
github.com/stretchr/testify v1.2.2
github.com/stretchr/testify v1.4.0
)

require (
github.com/armon/go-metrics v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.16.0 // indirect
golang.org/x/sys v0.13.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
147 changes: 141 additions & 6 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion memberlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"sync/atomic"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/go-metrics/compat"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-sockaddr"
"github.com/miekg/dns"
Expand Down
2 changes: 1 addition & 1 deletion net.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"sync/atomic"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/go-metrics/compat"
"github.com/hashicorp/go-msgpack/v2/codec"
)

Expand Down
2 changes: 1 addition & 1 deletion net_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sync/atomic"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/go-metrics/compat"
sockaddr "github.com/hashicorp/go-sockaddr"
)

Expand Down
2 changes: 1 addition & 1 deletion state.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sync/atomic"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/go-metrics/compat"
)

type NodeStateType int
Expand Down
2 changes: 1 addition & 1 deletion state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"testing"
"time"

"github.com/armon/go-metrics"
"github.com/hashicorp/go-metrics/compat"
iretry "github.com/hashicorp/memberlist/internal/retry"
"github.com/stretchr/testify/require"
)
Expand Down

0 comments on commit 167b9d0

Please sign in to comment.