Update import paths
Peter Bourgon
8 years ago
0 | 0 |
package main
|
1 | 1 |
|
2 | 2 |
import (
|
3 | |
"github.com/peterbourgon/gokit/server"
|
4 | 3 |
"golang.org/x/net/context"
|
|
4 |
|
|
5 |
"github.com/go-kit/kit/server"
|
5 | 6 |
)
|
6 | 7 |
|
7 | 8 |
// makeEndpoint returns a server.Endpoint wrapping the passed Add. If Add were
|
2 | 2 |
import (
|
3 | 3 |
"time"
|
4 | 4 |
|
5 | |
"github.com/peterbourgon/gokit/log"
|
|
5 |
"github.com/go-kit/kit/log"
|
6 | 6 |
)
|
7 | 7 |
|
8 | 8 |
func logging(logger log.Logger, add Add) Add {
|
4 | 4 |
|
5 | 5 |
"golang.org/x/net/context"
|
6 | 6 |
|
7 | |
"github.com/peterbourgon/gokit/addsvc/pb"
|
8 | |
"github.com/peterbourgon/gokit/metrics"
|
9 | |
"github.com/peterbourgon/gokit/server"
|
|
7 |
"github.com/go-kit/kit/addsvc/pb"
|
|
8 |
"github.com/go-kit/kit/metrics"
|
|
9 |
"github.com/go-kit/kit/server"
|
10 | 10 |
)
|
11 | 11 |
|
12 | 12 |
// A binding wraps an Endpoint so that it's usable by a transport. grpcBinding
|
3 | 3 |
"net/http"
|
4 | 4 |
"time"
|
5 | 5 |
|
6 | |
"github.com/peterbourgon/gokit/metrics"
|
|
6 |
"github.com/go-kit/kit/metrics"
|
7 | 7 |
)
|
8 | 8 |
|
9 | 9 |
// HTTP bindings require no service-specific declarations, and so are defined
|
18 | 18 |
"golang.org/x/net/context"
|
19 | 19 |
"google.golang.org/grpc"
|
20 | 20 |
|
21 | |
thriftadd "github.com/peterbourgon/gokit/addsvc/_thrift/gen-go/add"
|
22 | |
"github.com/peterbourgon/gokit/addsvc/pb"
|
23 | |
kitlog "github.com/peterbourgon/gokit/log"
|
24 | |
"github.com/peterbourgon/gokit/metrics"
|
25 | |
"github.com/peterbourgon/gokit/metrics/expvar"
|
26 | |
"github.com/peterbourgon/gokit/metrics/statsd"
|
27 | |
"github.com/peterbourgon/gokit/server"
|
28 | |
"github.com/peterbourgon/gokit/tracing/zipkin"
|
29 | |
jsoncodec "github.com/peterbourgon/gokit/transport/codec/json"
|
30 | |
httptransport "github.com/peterbourgon/gokit/transport/http"
|
|
21 |
thriftadd "github.com/go-kit/kit/addsvc/_thrift/gen-go/add"
|
|
22 |
"github.com/go-kit/kit/addsvc/pb"
|
|
23 |
kitlog "github.com/go-kit/kit/log"
|
|
24 |
"github.com/go-kit/kit/metrics"
|
|
25 |
"github.com/go-kit/kit/metrics/expvar"
|
|
26 |
"github.com/go-kit/kit/metrics/statsd"
|
|
27 |
"github.com/go-kit/kit/server"
|
|
28 |
"github.com/go-kit/kit/tracing/zipkin"
|
|
29 |
jsoncodec "github.com/go-kit/kit/transport/codec/json"
|
|
30 |
httptransport "github.com/go-kit/kit/transport/http"
|
31 | 31 |
)
|
32 | 32 |
|
33 | 33 |
func main() {
|
4 | 4 |
|
5 | 5 |
"golang.org/x/net/context"
|
6 | 6 |
|
7 | |
thriftadd "github.com/peterbourgon/gokit/addsvc/_thrift/gen-go/add"
|
8 | |
"github.com/peterbourgon/gokit/metrics"
|
9 | |
"github.com/peterbourgon/gokit/server"
|
|
7 |
thriftadd "github.com/go-kit/kit/addsvc/_thrift/gen-go/add"
|
|
8 |
"github.com/go-kit/kit/metrics"
|
|
9 |
"github.com/go-kit/kit/server"
|
10 | 10 |
)
|
11 | 11 |
|
12 | 12 |
// A binding wraps an Endpoint so that it's usable by a transport.
|
2 | 2 |
import (
|
3 | 3 |
"testing"
|
4 | 4 |
|
5 | |
"github.com/peterbourgon/gokit/log"
|
|
5 |
"github.com/go-kit/kit/log"
|
6 | 6 |
)
|
7 | 7 |
|
8 | 8 |
func benchmarkRunner(b *testing.B, logger log.Logger, f func(log.Logger)) {
|
4 | 4 |
"sync"
|
5 | 5 |
"testing"
|
6 | 6 |
|
7 | |
"github.com/peterbourgon/gokit/log"
|
|
7 |
"github.com/go-kit/kit/log"
|
8 | 8 |
)
|
9 | 9 |
|
10 | 10 |
// These test are designed to be run with the race detector.
|
5 | 5 |
"io/ioutil"
|
6 | 6 |
"testing"
|
7 | 7 |
|
8 | |
"github.com/peterbourgon/gokit/log"
|
|
8 |
"github.com/go-kit/kit/log"
|
9 | 9 |
)
|
10 | 10 |
|
11 | 11 |
func TestJSONLogger(t *testing.T) {
|
3 | 3 |
"bytes"
|
4 | 4 |
"testing"
|
5 | 5 |
|
6 | |
"github.com/peterbourgon/gokit/log"
|
|
6 |
"github.com/go-kit/kit/log"
|
7 | 7 |
)
|
8 | 8 |
|
9 | 9 |
func TestDefaultLevels(t *testing.T) {
|
4 | 4 |
"sync"
|
5 | 5 |
"testing"
|
6 | 6 |
|
7 | |
"github.com/peterbourgon/gokit/log"
|
|
7 |
"github.com/go-kit/kit/log"
|
8 | 8 |
)
|
9 | 9 |
|
10 | 10 |
var discard = log.Logger(log.LoggerFunc(func(...interface{}) error { return nil }))
|
5 | 5 |
"io/ioutil"
|
6 | 6 |
"testing"
|
7 | 7 |
|
8 | |
"github.com/peterbourgon/gokit/log"
|
|
8 |
"github.com/go-kit/kit/log"
|
9 | 9 |
)
|
10 | 10 |
|
11 | 11 |
func TestPrefixLogger(t *testing.T) {
|
4 | 4 |
"testing"
|
5 | 5 |
"time"
|
6 | 6 |
|
7 | |
"github.com/peterbourgon/gokit/log"
|
|
7 |
"github.com/go-kit/kit/log"
|
8 | 8 |
)
|
9 | 9 |
|
10 | 10 |
func TestValueBinding(t *testing.T) {
|
22 | 22 |
"sync"
|
23 | 23 |
"time"
|
24 | 24 |
|
25 | |
"github.com/peterbourgon/gokit/metrics"
|
|
25 |
"github.com/codahale/hdrhistogram"
|
26 | 26 |
|
27 | |
"github.com/codahale/hdrhistogram"
|
|
27 |
"github.com/go-kit/kit/metrics"
|
28 | 28 |
)
|
29 | 29 |
|
30 | 30 |
type counter struct {
|
4 | 4 |
"fmt"
|
5 | 5 |
"testing"
|
6 | 6 |
|
7 | |
"github.com/peterbourgon/gokit/metrics/expvar"
|
8 | |
"github.com/peterbourgon/gokit/metrics/teststat"
|
|
7 |
"github.com/go-kit/kit/metrics/expvar"
|
|
8 |
"github.com/go-kit/kit/metrics/teststat"
|
9 | 9 |
)
|
10 | 10 |
|
11 | 11 |
func TestHistogramQuantiles(t *testing.T) {
|
14 | 14 |
|
15 | 15 |
stdprometheus "github.com/prometheus/client_golang/prometheus"
|
16 | 16 |
|
17 | |
"github.com/peterbourgon/gokit/metrics"
|
18 | |
"github.com/peterbourgon/gokit/metrics/expvar"
|
19 | |
"github.com/peterbourgon/gokit/metrics/prometheus"
|
|
17 |
"github.com/go-kit/kit/metrics"
|
|
18 |
"github.com/go-kit/kit/metrics/expvar"
|
|
19 |
"github.com/go-kit/kit/metrics/prometheus"
|
20 | 20 |
)
|
21 | 21 |
|
22 | 22 |
func TestMultiWith(t *testing.T) {
|
3 | 3 |
import (
|
4 | 4 |
"github.com/prometheus/client_golang/prometheus"
|
5 | 5 |
|
6 | |
"github.com/peterbourgon/gokit/metrics"
|
|
6 |
"github.com/go-kit/kit/metrics"
|
7 | 7 |
)
|
8 | 8 |
|
9 | 9 |
// Prometheus has strong opinions about the dimensionality of fields. Users
|
5 | 5 |
|
6 | 6 |
stdprometheus "github.com/prometheus/client_golang/prometheus"
|
7 | 7 |
|
8 | |
"github.com/peterbourgon/gokit/metrics"
|
9 | |
"github.com/peterbourgon/gokit/metrics/prometheus"
|
10 | |
"github.com/peterbourgon/gokit/metrics/teststat"
|
|
8 |
"github.com/go-kit/kit/metrics"
|
|
9 |
"github.com/go-kit/kit/metrics/prometheus"
|
|
10 |
"github.com/go-kit/kit/metrics/teststat"
|
11 | 11 |
)
|
12 | 12 |
|
13 | 13 |
func TestPrometheusLabelBehavior(t *testing.T) {
|
2 | 2 |
import (
|
3 | 3 |
"testing"
|
4 | 4 |
|
5 | |
"github.com/peterbourgon/gokit/metrics"
|
6 | |
"github.com/peterbourgon/gokit/metrics/expvar"
|
|
5 |
"github.com/go-kit/kit/metrics"
|
|
6 |
"github.com/go-kit/kit/metrics/expvar"
|
7 | 7 |
)
|
8 | 8 |
|
9 | 9 |
func TestScaledHistogram(t *testing.T) {
|
18 | 18 |
"log"
|
19 | 19 |
"time"
|
20 | 20 |
|
21 | |
"github.com/peterbourgon/gokit/metrics"
|
|
21 |
"github.com/go-kit/kit/metrics"
|
22 | 22 |
)
|
23 | 23 |
|
24 | 24 |
// statsd metrics take considerable influence from
|
6 | 6 |
"math/rand"
|
7 | 7 |
"testing"
|
8 | 8 |
|
9 | |
"github.com/peterbourgon/gokit/metrics"
|
|
9 |
"github.com/go-kit/kit/metrics"
|
10 | 10 |
)
|
11 | 11 |
|
12 | 12 |
const population = 1234
|
4 | 4 |
"testing"
|
5 | 5 |
"time"
|
6 | 6 |
|
7 | |
"github.com/peterbourgon/gokit/metrics"
|
8 | |
"github.com/peterbourgon/gokit/metrics/expvar"
|
|
7 |
"github.com/go-kit/kit/metrics"
|
|
8 |
"github.com/go-kit/kit/metrics/expvar"
|
9 | 9 |
)
|
10 | 10 |
|
11 | 11 |
func TestTimeHistogram(t *testing.T) {
|
14 | 14 |
- Package metrics SHALL implement Gauges, Counters, and Histograms.
|
15 | 15 |
|
16 | 16 |
- Each metric type SHALL allow observations with an unlimited number of key/value field pairs,
|
17 | |
similar to [package log](https://github.com/peterbourgon/gokit/blob/master/rfc/rfc004-package-log.md).
|
|
17 |
similar to [package log](https://github.com/go-kit/kit/blob/master/rfc/rfc004-package-log.md).
|
18 | 18 |
|
19 | 19 |
- Counter SHALL be an increment-only counter of type uint64.
|
20 | 20 |
|
|
34 | 34 |
|
35 | 35 |
## Implementation
|
36 | 36 |
|
37 | |
https://github.com/peterbourgon/gokit/tree/master/metrics
|
|
37 |
https://github.com/go-kit/kit/tree/master/metrics
|
38 | 38 |
|
39 | 39 |
### Gauge
|
40 | 40 |
|
9 | 9 |
|
10 | 10 |
"github.com/apache/thrift/lib/go/thrift"
|
11 | 11 |
|
12 | |
"github.com/peterbourgon/gokit/log"
|
13 | |
"github.com/peterbourgon/gokit/tracing/zipkin/_thrift/gen-go/scribe"
|
|
12 |
"github.com/go-kit/kit/log"
|
|
13 |
"github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/scribe"
|
14 | 14 |
)
|
15 | 15 |
|
16 | 16 |
// Collector represents a Zipkin trace collector, which is probably a set of
|
10 | 10 |
|
11 | 11 |
"github.com/apache/thrift/lib/go/thrift"
|
12 | 12 |
|
13 | |
"github.com/peterbourgon/gokit/tracing/zipkin"
|
14 | |
"github.com/peterbourgon/gokit/tracing/zipkin/_thrift/gen-go/scribe"
|
15 | |
"github.com/peterbourgon/gokit/tracing/zipkin/_thrift/gen-go/zipkincore"
|
|
13 |
"github.com/go-kit/kit/tracing/zipkin"
|
|
14 |
"github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/scribe"
|
|
15 |
"github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore"
|
16 | 16 |
)
|
17 | 17 |
|
18 | 18 |
func TestScribeCollector(t *testing.T) {
|
3 | 3 |
"errors"
|
4 | 4 |
"time"
|
5 | 5 |
|
6 | |
"github.com/peterbourgon/gokit/tracing/zipkin/_thrift/gen-go/zipkincore"
|
|
6 |
"github.com/go-kit/kit/tracing/zipkin/_thrift/gen-go/zipkincore"
|
7 | 7 |
)
|
8 | 8 |
|
9 | 9 |
var (
|
6 | 6 |
|
7 | 7 |
"golang.org/x/net/context"
|
8 | 8 |
|
9 | |
"github.com/peterbourgon/gokit/server"
|
|
9 |
"github.com/go-kit/kit/server"
|
10 | 10 |
)
|
11 | 11 |
|
12 | 12 |
// http://www.slideshare.net/johanoskarsson/zipkin-runtime-open-house
|
6 | 6 |
"sync/atomic"
|
7 | 7 |
"testing"
|
8 | 8 |
|
9 | |
"github.com/peterbourgon/gokit/server"
|
10 | |
|
11 | 9 |
"golang.org/x/net/context"
|
12 | 10 |
|
13 | |
"github.com/peterbourgon/gokit/tracing/zipkin"
|
|
11 |
"github.com/go-kit/kit/server"
|
|
12 |
"github.com/go-kit/kit/tracing/zipkin"
|
14 | 13 |
)
|
15 | 14 |
|
16 | 15 |
func TestAnnotateEndpoint(t *testing.T) {
|
4 | 4 |
|
5 | 5 |
"golang.org/x/net/context"
|
6 | 6 |
|
7 | |
"github.com/peterbourgon/gokit/server"
|
|
7 |
"github.com/go-kit/kit/server"
|
8 | 8 |
)
|
9 | 9 |
|
10 | 10 |
// Codec defines how to decode and encode requests and responses. Decode takes
|
5 | 5 |
|
6 | 6 |
"golang.org/x/net/context"
|
7 | 7 |
|
8 | |
"github.com/peterbourgon/gokit/server"
|
9 | |
"github.com/peterbourgon/gokit/transport/codec"
|
|
8 |
"github.com/go-kit/kit/server"
|
|
9 |
"github.com/go-kit/kit/transport/codec"
|
10 | 10 |
)
|
11 | 11 |
|
12 | 12 |
type jsonCodec struct{}
|
5 | 5 |
|
6 | 6 |
"golang.org/x/net/context"
|
7 | 7 |
|
8 | |
jsoncodec "github.com/peterbourgon/gokit/transport/codec/json"
|
|
8 |
jsoncodec "github.com/go-kit/kit/transport/codec/json"
|
9 | 9 |
)
|
10 | 10 |
|
11 | 11 |
type request struct {
|
5 | 5 |
|
6 | 6 |
"golang.org/x/net/context"
|
7 | 7 |
|
8 | |
"github.com/peterbourgon/gokit/server"
|
9 | |
"github.com/peterbourgon/gokit/transport/codec"
|
|
8 |
"github.com/go-kit/kit/server"
|
|
9 |
"github.com/go-kit/kit/transport/codec"
|
10 | 10 |
)
|
11 | 11 |
|
12 | 12 |
// BindingOption sets a parameter for the binding.
|
10 | 10 |
|
11 | 11 |
"golang.org/x/net/context"
|
12 | 12 |
|
13 | |
"github.com/peterbourgon/gokit/server"
|
14 | |
jsoncodec "github.com/peterbourgon/gokit/transport/codec/json"
|
15 | |
httptransport "github.com/peterbourgon/gokit/transport/http"
|
|
13 |
"github.com/go-kit/kit/server"
|
|
14 |
jsoncodec "github.com/go-kit/kit/transport/codec/json"
|
|
15 |
httptransport "github.com/go-kit/kit/transport/http"
|
16 | 16 |
)
|
17 | 17 |
|
18 | 18 |
func TestBinding(t *testing.T) {
|