Segregate imports per go-kit conventions
Ben Sigelman
7 years ago
2 | 2 |
import (
|
3 | 3 |
"io"
|
4 | 4 |
|
|
5 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
|
6 |
"github.com/opentracing/opentracing-go"
|
5 | 7 |
"google.golang.org/grpc"
|
6 | 8 |
|
7 | 9 |
"github.com/go-kit/kit/endpoint"
|
8 | 10 |
"github.com/go-kit/kit/examples/addsvc/pb"
|
9 | 11 |
"github.com/go-kit/kit/loadbalancer"
|
10 | 12 |
"github.com/go-kit/kit/log"
|
11 | |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
12 | 13 |
grpctransport "github.com/go-kit/kit/transport/grpc"
|
13 | |
"github.com/opentracing/opentracing-go"
|
14 | 14 |
)
|
15 | 15 |
|
16 | 16 |
// MakeSumEndpointFactory returns a loadbalancer.Factory that transforms GRPC
|
2 | 2 |
import (
|
3 | 3 |
"io"
|
4 | 4 |
"net/url"
|
|
5 |
|
|
6 |
"github.com/opentracing/opentracing-go"
|
5 | 7 |
|
6 | 8 |
"github.com/go-kit/kit/endpoint"
|
7 | 9 |
"github.com/go-kit/kit/examples/addsvc/server"
|
|
9 | 11 |
"github.com/go-kit/kit/log"
|
10 | 12 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
11 | 13 |
httptransport "github.com/go-kit/kit/transport/http"
|
12 | |
"github.com/opentracing/opentracing-go"
|
13 | 14 |
)
|
14 | 15 |
|
15 | 16 |
// MakeSumEndpointFactory generates a Factory that transforms an http url into
|
8 | 8 |
"strings"
|
9 | 9 |
"time"
|
10 | 10 |
|
|
11 |
"github.com/lightstep/lightstep-tracer-go"
|
|
12 |
"github.com/opentracing/opentracing-go"
|
|
13 |
appdashot "github.com/sourcegraph/appdash/opentracing"
|
11 | 14 |
"golang.org/x/net/context"
|
|
15 |
"sourcegraph.com/sourcegraph/appdash"
|
12 | 16 |
|
13 | 17 |
"github.com/go-kit/kit/endpoint"
|
14 | 18 |
grpcclient "github.com/go-kit/kit/examples/addsvc/client/grpc"
|
|
19 | 23 |
"github.com/go-kit/kit/loadbalancer/static"
|
20 | 24 |
"github.com/go-kit/kit/log"
|
21 | 25 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
22 | |
"github.com/lightstep/lightstep-tracer-go"
|
23 | |
"github.com/opentracing/opentracing-go"
|
24 | |
appdashot "github.com/sourcegraph/appdash/opentracing"
|
25 | |
"sourcegraph.com/sourcegraph/appdash"
|
26 | 26 |
)
|
27 | 27 |
|
28 | 28 |
func main() {
|
1 | 1 |
|
2 | 2 |
import (
|
3 | 3 |
"golang.org/x/net/context"
|
|
4 |
|
|
5 |
"github.com/opentracing/opentracing-go"
|
4 | 6 |
|
5 | 7 |
"github.com/go-kit/kit/examples/addsvc/pb"
|
6 | 8 |
"github.com/go-kit/kit/examples/addsvc/server"
|
|
8 | 10 |
"github.com/go-kit/kit/log"
|
9 | 11 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
10 | 12 |
"github.com/go-kit/kit/transport/grpc"
|
11 | |
"github.com/opentracing/opentracing-go"
|
12 | 13 |
)
|
13 | 14 |
|
14 | 15 |
type grpcBinding struct {
|
14 | 14 |
"time"
|
15 | 15 |
|
16 | 16 |
"github.com/apache/thrift/lib/go/thrift"
|
17 | |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
18 | 17 |
"github.com/lightstep/lightstep-tracer-go"
|
19 | 18 |
"github.com/opentracing/opentracing-go"
|
20 | 19 |
stdprometheus "github.com/prometheus/client_golang/prometheus"
|
|
31 | 30 |
"github.com/go-kit/kit/metrics"
|
32 | 31 |
"github.com/go-kit/kit/metrics/expvar"
|
33 | 32 |
"github.com/go-kit/kit/metrics/prometheus"
|
|
33 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
34 | 34 |
"github.com/go-kit/kit/tracing/zipkin"
|
35 | 35 |
httptransport "github.com/go-kit/kit/transport/http"
|
36 | 36 |
)
|
0 | 0 |
package opentracing
|
1 | 1 |
|
2 | 2 |
import (
|
3 | |
"github.com/go-kit/kit/endpoint"
|
4 | 3 |
"github.com/opentracing/opentracing-go"
|
5 | 4 |
otext "github.com/opentracing/opentracing-go/ext"
|
6 | 5 |
"golang.org/x/net/context"
|
|
6 |
|
|
7 |
"github.com/go-kit/kit/endpoint"
|
7 | 8 |
)
|
8 | 9 |
|
9 | 10 |
// TraceServer returns a Middleware that wraps the `next` Endpoint in an
|
2 | 2 |
import (
|
3 | 3 |
"testing"
|
4 | 4 |
|
5 | |
"github.com/go-kit/kit/endpoint"
|
6 | |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
7 | 5 |
"github.com/opentracing/opentracing-go"
|
8 | 6 |
"github.com/opentracing/opentracing-go/mocktracer"
|
9 | 7 |
"golang.org/x/net/context"
|
|
8 |
|
|
9 |
"github.com/go-kit/kit/endpoint"
|
|
10 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
10 | 11 |
)
|
11 | 12 |
|
12 | 13 |
func TestTraceServer(t *testing.T) {
|
0 | 0 |
package opentracing
|
1 | 1 |
|
2 | 2 |
import (
|
3 | |
"github.com/go-kit/kit/log"
|
4 | 3 |
"github.com/opentracing/opentracing-go"
|
5 | 4 |
"golang.org/x/net/context"
|
6 | 5 |
"google.golang.org/grpc/metadata"
|
|
6 |
|
|
7 |
"github.com/go-kit/kit/log"
|
7 | 8 |
)
|
8 | 9 |
|
9 | 10 |
// ToGRPCRequest returns a grpc RequestFunc that injects an OpenTracing Span
|
2 | 2 |
import (
|
3 | 3 |
"testing"
|
4 | 4 |
|
|
5 |
"github.com/opentracing/opentracing-go"
|
|
6 |
"github.com/opentracing/opentracing-go/mocktracer"
|
|
7 |
"golang.org/x/net/context"
|
5 | 8 |
"google.golang.org/grpc/metadata"
|
6 | 9 |
|
7 | 10 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
8 | 11 |
"github.com/go-kit/kit/transport/grpc"
|
9 | |
"github.com/opentracing/opentracing-go"
|
10 | |
"github.com/opentracing/opentracing-go/mocktracer"
|
11 | |
"golang.org/x/net/context"
|
12 | 12 |
)
|
13 | 13 |
|
14 | 14 |
func TestTraceGRPCRequestRoundtrip(t *testing.T) {
|
4 | 4 |
"net/http"
|
5 | 5 |
"strconv"
|
6 | 6 |
|
7 | |
"github.com/go-kit/kit/log"
|
8 | |
kithttp "github.com/go-kit/kit/transport/http"
|
9 | 7 |
"github.com/opentracing/opentracing-go"
|
10 | 8 |
"github.com/opentracing/opentracing-go/ext"
|
11 | 9 |
"golang.org/x/net/context"
|
|
10 |
|
|
11 |
"github.com/go-kit/kit/log"
|
|
12 |
kithttp "github.com/go-kit/kit/transport/http"
|
12 | 13 |
)
|
13 | 14 |
|
14 | 15 |
// ToHTTPRequest returns an http RequestFunc that injects an OpenTracing Span
|
3 | 3 |
"net/http"
|
4 | 4 |
"testing"
|
5 | 5 |
|
6 | |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
7 | |
kithttp "github.com/go-kit/kit/transport/http"
|
8 | 6 |
"github.com/opentracing/opentracing-go"
|
9 | 7 |
"github.com/opentracing/opentracing-go/mocktracer"
|
10 | 8 |
"golang.org/x/net/context"
|
|
9 |
|
|
10 |
kitot "github.com/go-kit/kit/tracing/opentracing"
|
|
11 |
kithttp "github.com/go-kit/kit/transport/http"
|
11 | 12 |
)
|
12 | 13 |
|
13 | 14 |
func TestTraceHTTPRequestRoundtrip(t *testing.T) {
|