Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: update v4 to v5 #171

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Installation
------------

```
go get github.com/segmentio/stats/v4
go get github.com/segmentio/stats/v5
```

Migration to v4
Migration to v5
---------------

Version 4 of the stats package introduced a new way of producing metrics based
Expand Down Expand Up @@ -101,8 +101,8 @@ collection platforms.
package main

import (
"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v5"
"github.com/segmentio/stats/v5/datadog"
)

func main() {
Expand Down Expand Up @@ -132,8 +132,8 @@ func main() {
package main

import (
"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v5"
"github.com/segmentio/stats/v5/datadog"
)

func main() {
Expand Down Expand Up @@ -183,7 +183,7 @@ Monitoring

> 🚧 Go metrics reported with the `procstats` package were previously tagged with a
> `version` label that reported the Go runtime version. This label was renamed to
> `go_version` in v4.6.0.
> `go_version` in v5.6.0.

The
[github.com/segmentio/stats/procstats](https://godoc.org/github.com/segmentio/stats/procstats)
Expand All @@ -197,8 +197,8 @@ Here's an example of how to use the collector:
package main

import (
"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v4/procstats"
"github.com/segmentio/stats/v5/datadog"
"github.com/segmentio/stats/v5/procstats"
)


Expand Down Expand Up @@ -245,8 +245,8 @@ package main
import (
"net/http"

"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v4/httpstats"
"github.com/segmentio/stats/v5/datadog"
"github.com/segmentio/stats/v5/httpstats"
)

func main() {
Expand Down Expand Up @@ -279,8 +279,8 @@ package main
import (
"net/http"

"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v4/httpstats"
"github.com/segmentio/stats/v5/datadog"
"github.com/segmentio/stats/v5/httpstats"
)

func main() {
Expand Down Expand Up @@ -308,8 +308,8 @@ package main
import (
"net/http"

"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v4/httpstats"
"github.com/segmentio/stats/v5/datadog"
"github.com/segmentio/stats/v5/httpstats"
)

func main() {
Expand Down Expand Up @@ -342,7 +342,7 @@ package main

import (
"github.com/segmentio/redis-go"
"github.com/segmentio/stats/v4/redisstats"
"github.com/segmentio/stats/v5/redisstats"
)

func main() {
Expand All @@ -365,7 +365,7 @@ package main

import (
"github.com/segmentio/redis-go"
"github.com/segmentio/stats/v4/redisstats"
"github.com/segmentio/stats/v5/redisstats"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/dogstatsd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"strings"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v5"
"github.com/segmentio/stats/v5/datadog"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion datadog/append.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"strings"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

func appendMetric(b []byte, m Metric) []byte {
Expand Down
4 changes: 2 additions & 2 deletions datadog/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"

"golang.org/x/sys/unix"
)
Expand Down Expand Up @@ -178,7 +178,7 @@ func dial(address string, sizehint int) (conn net.Conn, bufsize int, err error)
}

// Even tho the buffer agrees to support a bigger size it shouldn't be
// possible to send datagrams larger than 65 KB on an IPv4 socket, so let's
// possible to send datagrams larger than 65 KB on an IPv5 socket, so let's
// enforce the max size.
if bufsize > MaxBufferSize {
bufsize = MaxBufferSize
Expand Down
2 changes: 1 addition & 1 deletion datadog/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"

"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion datadog/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package datadog
import (
"fmt"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// EventPriority is an enumeration providing the available datadog event
Expand Down
2 changes: 1 addition & 1 deletion datadog/event_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package datadog

import (
"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

var testEvents = []struct {
Expand Down
2 changes: 1 addition & 1 deletion datadog/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"sync"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// MetricType is an enumeration providing symbols to represent the different
Expand Down
2 changes: 1 addition & 1 deletion datadog/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package datadog
import (
"testing"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

var testMetrics = []struct {
Expand Down
2 changes: 1 addition & 1 deletion datadog/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"
"strings"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// Adapted from https://github.com/DataDog/datadog-agent/blob/6789e98a1e41e98700fa1783df62238bb23cb454/pkg/dogstatsd/parser.go#L141
Expand Down
2 changes: 1 addition & 1 deletion datadog/serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// Datagram format: https://docs.datadoghq.com/developers/dogstatsd/datagram_shell
Expand Down
2 changes: 1 addition & 1 deletion datadog/serializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

var testMeasures = []struct {
Expand Down
2 changes: 1 addition & 1 deletion datadog/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

func TestServer(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"testing"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v4/datadog"
"github.com/segmentio/stats/v4/influxdb"
"github.com/segmentio/stats/v4/prometheus"
"github.com/segmentio/stats/v4/statstest"
"github.com/segmentio/stats/v5"
"github.com/segmentio/stats/v5/datadog"
"github.com/segmentio/stats/v5/influxdb"
"github.com/segmentio/stats/v5/prometheus"
"github.com/segmentio/stats/v5/statstest"
)

func TestEngine(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/segmentio/stats/v4
module github.com/segmentio/stats/v5

go 1.18

Expand Down
2 changes: 1 addition & 1 deletion grafana/grafanatest/annotations.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package grafanatest

import "github.com/segmentio/stats/v4/grafana"
import "github.com/segmentio/stats/v5/grafana"

// AnnotationsResponse is an implementation of the grafana.AnnotationsResponse
// interface which captures the values passed to its method calls.
Expand Down
2 changes: 1 addition & 1 deletion grafana/grafanatest/annotations_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package grafanatest

import "github.com/segmentio/stats/v4/grafana"
import "github.com/segmentio/stats/v5/grafana"

var _ grafana.AnnotationsResponse = (*AnnotationsResponse)(nil)
2 changes: 1 addition & 1 deletion grafana/grafanatest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package grafanatest
import (
"time"

"github.com/segmentio/stats/v4/grafana"
"github.com/segmentio/stats/v5/grafana"
)

// QueryResponse is an implementation of the grafana.QueryResponse interface
Expand Down
2 changes: 1 addition & 1 deletion grafana/grafanatest/query_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package grafanatest

import "github.com/segmentio/stats/v4/grafana"
import "github.com/segmentio/stats/v5/grafana"

var _ grafana.QueryResponse = (*QueryResponse)(nil)
2 changes: 1 addition & 1 deletion grafana/grafanatest/search_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package grafanatest

import "github.com/segmentio/stats/v4/grafana"
import "github.com/segmentio/stats/v5/grafana"

var _ grafana.SearchResponse = (*SearchResponse)(nil)
4 changes: 2 additions & 2 deletions handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v4/statstest"
"github.com/segmentio/stats/v5"
"github.com/segmentio/stats/v5/statstest"

"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion httpstats/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package httpstats
import (
"net/http"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// RequestWithTags returns a shallow copy of req with its context updated to
Expand Down
2 changes: 1 addition & 1 deletion httpstats/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// TestRequestContextTagPropegation verifies that the root ancestor tags are
Expand Down
2 changes: 1 addition & 1 deletion httpstats/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// NewHandler wraps h to produce metrics on the default engine for every request
Expand Down
4 changes: 2 additions & 2 deletions httpstats/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"testing"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v4/statstest"
"github.com/segmentio/stats/v5"
"github.com/segmentio/stats/v5/statstest"
)

func TestHandler(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion httpstats/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sync"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion httpstats/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

"github.com/segmentio/stats/v4/iostats"
"github.com/segmentio/stats/v5/iostats"
)

func TestResponseStatusBucket(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion httpstats/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// NewTransport wraps t to produce metrics on the default engine for every request
Expand Down
4 changes: 2 additions & 2 deletions httpstats/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"testing"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v4/statstest"
"github.com/segmentio/stats/v5"
"github.com/segmentio/stats/v5/statstest"
)

func TestTransport(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion influxdb/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/segmentio/objconv/json"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion influxdb/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

func DisabledTestClient(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion influxdb/measure.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strconv"
"time"

"github.com/segmentio/stats/v4"
"github.com/segmentio/stats/v5"
)

// AppendMeasure is a formatting routine to append the InflxDB line protocol
Expand Down
Loading
Loading