Codebase list golang-github-go-kit-kit / f72181f
Fix build (#917) * make go vet happy (renamed example function for syslog) * adjust Zipkin OpenTracing example to use the new bridge version of zipkin-go-opentracing * fix expected output from kit-gen due to change in gofmt handling of imports Peter Bourgon authored 4 years ago GitHub committed 4 years ago
26 changed file(s) with 240 addition(s) and 227 deletion(s). Raw diff Collapse all Expand all
00 package endpoints
11
2 import "context"
2 import (
3 "context"
34
4 import "github.com/go-kit/kit/endpoint"
5
6 import "github.com/go-kit/kit/cmd/kitgen/testdata/anonfields/default/service"
5 "github.com/go-kit/kit/cmd/kitgen/testdata/anonfields/default/service"
6 "github.com/go-kit/kit/endpoint"
7 )
78
89 type FooRequest struct {
910 I int
00 package http
11
2 import "context"
3 import "encoding/json"
2 import (
3 "context"
4 "encoding/json"
5 "net/http"
46
5 import "net/http"
6
7 import httptransport "github.com/go-kit/kit/transport/http"
8 import "github.com/go-kit/kit/cmd/kitgen/testdata/anonfields/default/endpoints"
7 "github.com/go-kit/kit/cmd/kitgen/testdata/anonfields/default/endpoints"
8 httptransport "github.com/go-kit/kit/transport/http"
9 )
910
1011 func NewHTTPHandler(endpoints endpoints.Endpoints) http.Handler {
1112 m := http.NewServeMux()
00 package service
11
2 import "context"
3
4 import "errors"
2 import (
3 "context"
4 "errors"
5 )
56
67 type Service struct {
78 }
00 package foo
11
2 import "context"
3 import "encoding/json"
4 import "errors"
5 import "net/http"
6 import "github.com/go-kit/kit/endpoint"
7 import httptransport "github.com/go-kit/kit/transport/http"
2 import (
3 "context"
4 "encoding/json"
5 "errors"
6 "net/http"
7
8 "github.com/go-kit/kit/endpoint"
9
10 httptransport "github.com/go-kit/kit/transport/http"
11 )
812
913 type Service struct {
1014 }
00 package endpoints
11
2 import "context"
2 import (
3 "context"
34
4 import "github.com/go-kit/kit/endpoint"
5
6 import "github.com/go-kit/kit/cmd/kitgen/testdata/foo/default/service"
5 "github.com/go-kit/kit/cmd/kitgen/testdata/foo/default/service"
6 "github.com/go-kit/kit/endpoint"
7 )
78
89 type BarRequest struct {
910 I int
00 package http
11
2 import "context"
3 import "encoding/json"
2 import (
3 "context"
4 "encoding/json"
5 "net/http"
46
5 import "net/http"
6
7 import httptransport "github.com/go-kit/kit/transport/http"
8 import "github.com/go-kit/kit/cmd/kitgen/testdata/foo/default/endpoints"
7 "github.com/go-kit/kit/cmd/kitgen/testdata/foo/default/endpoints"
8 httptransport "github.com/go-kit/kit/transport/http"
9 )
910
1011 func NewHTTPHandler(endpoints endpoints.Endpoints) http.Handler {
1112 m := http.NewServeMux()
00 package service
11
2 import "context"
3
4 import "errors"
2 import (
3 "context"
4 "errors"
5 )
56
67 type FooService struct {
78 }
00 package foo
11
2 import "context"
3 import "encoding/json"
4 import "errors"
5 import "net/http"
6 import "github.com/go-kit/kit/endpoint"
7 import httptransport "github.com/go-kit/kit/transport/http"
2 import (
3 "context"
4 "encoding/json"
5 "errors"
6 "net/http"
7
8 "github.com/go-kit/kit/endpoint"
9
10 httptransport "github.com/go-kit/kit/transport/http"
11 )
812
913 type FooService struct {
1014 }
00 package endpoints
11
2 import "context"
2 import (
3 "context"
34
4 import "github.com/go-kit/kit/endpoint"
5
6 import "github.com/go-kit/kit/cmd/kitgen/testdata/profilesvc/default/service"
5 "github.com/go-kit/kit/cmd/kitgen/testdata/profilesvc/default/service"
6 "github.com/go-kit/kit/endpoint"
7 )
78
89 type PostProfileRequest struct {
910 P service.Profile
00 package http
11
2 import "context"
3 import "encoding/json"
2 import (
3 "context"
4 "encoding/json"
5 "net/http"
46
5 import "net/http"
6
7 import httptransport "github.com/go-kit/kit/transport/http"
8 import "github.com/go-kit/kit/cmd/kitgen/testdata/profilesvc/default/endpoints"
7 "github.com/go-kit/kit/cmd/kitgen/testdata/profilesvc/default/endpoints"
8 httptransport "github.com/go-kit/kit/transport/http"
9 )
910
1011 func NewHTTPHandler(endpoints endpoints.Endpoints) http.Handler {
1112 m := http.NewServeMux()
00 package service
11
2 import "context"
3
4 import "errors"
2 import (
3 "context"
4 "errors"
5 )
56
67 type Profile struct {
78 ID string `json:"id"`
00 package profilesvc
11
2 import "context"
3 import "encoding/json"
4 import "errors"
5 import "net/http"
6 import "github.com/go-kit/kit/endpoint"
7 import httptransport "github.com/go-kit/kit/transport/http"
2 import (
3 "context"
4 "encoding/json"
5 "errors"
6 "net/http"
7
8 "github.com/go-kit/kit/endpoint"
9
10 httptransport "github.com/go-kit/kit/transport/http"
11 )
812
913 type Profile struct {
1014 ID string `json:"id"`
00 package endpoints
11
2 import "context"
2 import (
3 "context"
34
4 import "github.com/go-kit/kit/endpoint"
5
6 import "github.com/go-kit/kit/cmd/kitgen/testdata/stringservice/default/service"
5 "github.com/go-kit/kit/cmd/kitgen/testdata/stringservice/default/service"
6 "github.com/go-kit/kit/endpoint"
7 )
78
89 type ConcatRequest struct {
910 A string
00 package http
11
2 import "context"
3 import "encoding/json"
2 import (
3 "context"
4 "encoding/json"
5 "net/http"
46
5 import "net/http"
6
7 import httptransport "github.com/go-kit/kit/transport/http"
8 import "github.com/go-kit/kit/cmd/kitgen/testdata/stringservice/default/endpoints"
7 "github.com/go-kit/kit/cmd/kitgen/testdata/stringservice/default/endpoints"
8 httptransport "github.com/go-kit/kit/transport/http"
9 )
910
1011 func NewHTTPHandler(endpoints endpoints.Endpoints) http.Handler {
1112 m := http.NewServeMux()
00 package service
11
2 import "context"
3
4 import "errors"
2 import (
3 "context"
4 "errors"
5 )
56
67 type Service struct {
78 }
00 package foo
11
2 import "context"
3 import "encoding/json"
4 import "errors"
5 import "net/http"
6 import "github.com/go-kit/kit/endpoint"
7 import httptransport "github.com/go-kit/kit/transport/http"
2 import (
3 "context"
4 "encoding/json"
5 "errors"
6 "net/http"
7
8 "github.com/go-kit/kit/endpoint"
9
10 httptransport "github.com/go-kit/kit/transport/http"
11 )
812
913 type Service struct {
1014 }
00 package endpoints
11
2 import "context"
2 import (
3 "context"
34
4 import "github.com/go-kit/kit/endpoint"
5
6 import "github.com/go-kit/kit/cmd/kitgen/testdata/underscores/default/service"
5 "github.com/go-kit/kit/cmd/kitgen/testdata/underscores/default/service"
6 "github.com/go-kit/kit/endpoint"
7 )
78
89 type FooRequest struct {
910 I int
00 package http
11
2 import "context"
3 import "encoding/json"
2 import (
3 "context"
4 "encoding/json"
5 "net/http"
46
5 import "net/http"
6
7 import httptransport "github.com/go-kit/kit/transport/http"
8 import "github.com/go-kit/kit/cmd/kitgen/testdata/underscores/default/endpoints"
7 "github.com/go-kit/kit/cmd/kitgen/testdata/underscores/default/endpoints"
8 httptransport "github.com/go-kit/kit/transport/http"
9 )
910
1011 func NewHTTPHandler(endpoints endpoints.Endpoints) http.Handler {
1112 m := http.NewServeMux()
00 package service
11
2 import "context"
3
4 import "errors"
2 import (
3 "context"
4 "errors"
5 )
56
67 type Service struct {
78 }
00 package underscores
11
2 import "context"
3 import "encoding/json"
4 import "errors"
5 import "net/http"
6 import "github.com/go-kit/kit/endpoint"
7 import httptransport "github.com/go-kit/kit/transport/http"
2 import (
3 "context"
4 "encoding/json"
5 "errors"
6 "net/http"
7
8 "github.com/go-kit/kit/endpoint"
9
10 httptransport "github.com/go-kit/kit/transport/http"
11 )
812
913 type Service struct {
1014 }
4242 thriftProtocol = fs.String("thrift-protocol", "binary", "binary, compact, json, simplejson")
4343 thriftBuffer = fs.Int("thrift-buffer", 0, "0 for unbuffered")
4444 thriftFramed = fs.Bool("thrift-framed", false, "true to enable framing")
45 zipkinV2URL = fs.String("zipkin-url", "", "Enable Zipkin v2 tracing (zipkin-go) via HTTP Reporter URL e.g. http://localhost:9411/api/v2/spans")
46 zipkinV1URL = fs.String("zipkin-v1-url", "", "Enable Zipkin v1 tracing (zipkin-go-opentracing) via a collector URL e.g. http://localhost:9411/api/v1/spans")
45 zipkinURL = fs.String("zipkin-url", "", "Enable Zipkin tracing via HTTP reporter URL e.g. http://localhost:9411/api/v2/spans")
46 zipkinBridge = fs.Bool("zipkin-ot-bridge", false, "Use Zipkin OpenTracing bridge instead of native implementation")
4747 lightstepToken = fs.String("lightstep-token", "", "Enable LightStep tracing via a LightStep access token")
4848 appdashAddr = fs.String("appdash-addr", "", "Enable Appdash tracing via an Appdash server host:port")
4949 method = fs.String("method", "sum", "sum, concat")
5555 os.Exit(1)
5656 }
5757
58 // This is a demonstration of the native Zipkin tracing client. If using
59 // Zipkin this is the more idiomatic client over OpenTracing.
60 var zipkinTracer *zipkin.Tracer
61 {
62 if *zipkinURL != "" {
63 var (
64 err error
65 hostPort = "" // if host:port is unknown we can keep this empty
66 serviceName = "addsvc-cli"
67 reporter = zipkinhttp.NewReporter(*zipkinURL)
68 )
69 defer reporter.Close()
70 zEP, _ := zipkin.NewEndpoint(serviceName, hostPort)
71 zipkinTracer, err = zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(zEP))
72 if err != nil {
73 fmt.Fprintf(os.Stderr, "unable to create zipkin tracer: %s\n", err.Error())
74 os.Exit(1)
75 }
76 }
77 }
78
5879 // This is a demonstration client, which supports multiple tracers.
5980 // Your clients will probably just use one tracer.
6081 var otTracer stdopentracing.Tracer
6182 {
62 if *zipkinV1URL != "" && *zipkinV2URL == "" {
63 collector, err := zipkinot.NewHTTPCollector(*zipkinV1URL)
64 if err != nil {
65 fmt.Fprintln(os.Stderr, err.Error())
66 os.Exit(1)
67 }
68 defer collector.Close()
69 var (
70 debug = false
71 hostPort = "localhost:0"
72 serviceName = "addsvc-cli"
73 )
74 recorder := zipkinot.NewRecorder(collector, debug, hostPort, serviceName)
75 otTracer, err = zipkinot.NewTracer(recorder)
76 if err != nil {
77 fmt.Fprintln(os.Stderr, err.Error())
78 os.Exit(1)
79 }
83 if *zipkinBridge && zipkinTracer != nil {
84 otTracer = zipkinot.Wrap(zipkinTracer)
85 zipkinTracer = nil // do not instrument with both native and ot bridge
8086 } else if *lightstepToken != "" {
8187 otTracer = lightstep.NewTracer(lightstep.Options{
8288 AccessToken: *lightstepToken,
8692 otTracer = appdashot.NewTracer(appdash.NewRemoteCollector(*appdashAddr))
8793 } else {
8894 otTracer = stdopentracing.GlobalTracer() // no-op
89 }
90 }
91
92 // This is a demonstration of the native Zipkin tracing client. If using
93 // Zipkin this is the more idiomatic client over OpenTracing.
94 var zipkinTracer *zipkin.Tracer
95 {
96 var (
97 err error
98 hostPort = "" // if host:port is unknown we can keep this empty
99 serviceName = "addsvc-cli"
100 useNoopTracer = (*zipkinV2URL == "")
101 reporter = zipkinhttp.NewReporter(*zipkinV2URL)
102 )
103 defer reporter.Close()
104 zEP, _ := zipkin.NewEndpoint(serviceName, hostPort)
105 zipkinTracer, err = zipkin.NewTracer(
106 reporter, zipkin.WithLocalEndpoint(zEP), zipkin.WithNoopTracer(useNoopTracer),
107 )
108 if err != nil {
109 fmt.Fprintf(os.Stderr, "unable to create zipkin tracer: %s\n", err.Error())
110 os.Exit(1)
11195 }
11296 }
11397
4848 thriftProtocol = fs.String("thrift-protocol", "binary", "binary, compact, json, simplejson")
4949 thriftBuffer = fs.Int("thrift-buffer", 0, "0 for unbuffered")
5050 thriftFramed = fs.Bool("thrift-framed", false, "true to enable framing")
51 zipkinV2URL = fs.String("zipkin-url", "", "Enable Zipkin v2 tracing (zipkin-go) using a Reporter URL e.g. http://localhost:9411/api/v2/spans")
52 zipkinV1URL = fs.String("zipkin-v1-url", "", "Enable Zipkin v1 tracing (zipkin-go-opentracing) using a collector URL e.g. http://localhost:9411/api/v1/spans")
51 zipkinURL = fs.String("zipkin-url", "", "Enable Zipkin tracing via HTTP reporter URL e.g. http://localhost:9411/api/v2/spans")
52 zipkinBridge = fs.Bool("zipkin-ot-bridge", false, "Use Zipkin OpenTracing bridge instead of native implementation")
5353 lightstepToken = fs.String("lightstep-token", "", "Enable LightStep tracing via a LightStep access token")
5454 appdashAddr = fs.String("appdash-addr", "", "Enable Appdash tracing via an Appdash server host:port")
5555 )
6464 logger = log.With(logger, "caller", log.DefaultCaller)
6565 }
6666
67 var zipkinTracer *zipkin.Tracer
68 {
69 if *zipkinURL != "" {
70 var (
71 err error
72 hostPort = "localhost:80"
73 serviceName = "addsvc"
74 reporter = zipkinhttp.NewReporter(*zipkinURL)
75 )
76 defer reporter.Close()
77 zEP, _ := zipkin.NewEndpoint(serviceName, hostPort)
78 zipkinTracer, err = zipkin.NewTracer(reporter, zipkin.WithLocalEndpoint(zEP))
79 if err != nil {
80 logger.Log("err", err)
81 os.Exit(1)
82 }
83 if !(*zipkinBridge) {
84 logger.Log("tracer", "Zipkin", "type", "Native", "URL", *zipkinURL)
85 }
86 }
87 }
88
6789 // Determine which OpenTracing tracer to use. We'll pass the tracer to all the
6890 // components that use it, as a dependency.
6991 var tracer stdopentracing.Tracer
7092 {
71 if *zipkinV1URL != "" && *zipkinV2URL == "" {
72 logger.Log("tracer", "Zipkin", "type", "OpenTracing", "URL", *zipkinV1URL)
73 collector, err := zipkinot.NewHTTPCollector(*zipkinV1URL)
74 if err != nil {
75 logger.Log("err", err)
76 os.Exit(1)
77 }
78 defer collector.Close()
79 var (
80 debug = false
81 hostPort = "localhost:80"
82 serviceName = "addsvc"
83 )
84 recorder := zipkinot.NewRecorder(collector, debug, hostPort, serviceName)
85 tracer, err = zipkinot.NewTracer(recorder)
86 if err != nil {
87 logger.Log("err", err)
88 os.Exit(1)
89 }
93 if *zipkinBridge && zipkinTracer != nil {
94 logger.Log("tracer", "Zipkin", "type", "OpenTracing", "URL", *zipkinURL)
95 tracer = zipkinot.Wrap(zipkinTracer)
96 zipkinTracer = nil // do not instrument with both native tracer and opentracing bridge
9097 } else if *lightstepToken != "" {
9198 logger.Log("tracer", "LightStep") // probably don't want to print out the token :)
9299 tracer = lightstep.NewTracer(lightstep.Options{
98105 tracer = appdashot.NewTracer(appdash.NewRemoteCollector(*appdashAddr))
99106 } else {
100107 tracer = stdopentracing.GlobalTracer() // no-op
101 }
102 }
103
104 var zipkinTracer *zipkin.Tracer
105 {
106 var (
107 err error
108 hostPort = "localhost:80"
109 serviceName = "addsvc"
110 useNoopTracer = (*zipkinV2URL == "")
111 reporter = zipkinhttp.NewReporter(*zipkinV2URL)
112 )
113 defer reporter.Close()
114 zEP, _ := zipkin.NewEndpoint(serviceName, hostPort)
115 zipkinTracer, err = zipkin.NewTracer(
116 reporter, zipkin.WithLocalEndpoint(zEP), zipkin.WithNoopTracer(useNoopTracer),
117 )
118 if err != nil {
119 logger.Log("err", err)
120 os.Exit(1)
121 }
122 if !useNoopTracer {
123 logger.Log("tracer", "Zipkin", "type", "Native", "URL", *zipkinV2URL)
124108 }
125109 }
126110
3737 sumEndpoint = ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 1))(sumEndpoint)
3838 sumEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{}))(sumEndpoint)
3939 sumEndpoint = opentracing.TraceServer(otTracer, "Sum")(sumEndpoint)
40 sumEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Sum")(sumEndpoint)
40 if zipkinTracer != nil {
41 sumEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Sum")(sumEndpoint)
42 }
4143 sumEndpoint = LoggingMiddleware(log.With(logger, "method", "Sum"))(sumEndpoint)
4244 sumEndpoint = InstrumentingMiddleware(duration.With("method", "Sum"))(sumEndpoint)
4345 }
4749 concatEndpoint = ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 100))(concatEndpoint)
4850 concatEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{}))(concatEndpoint)
4951 concatEndpoint = opentracing.TraceServer(otTracer, "Concat")(concatEndpoint)
50 concatEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Concat")(concatEndpoint)
52 if zipkinTracer != nil {
53 concatEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Concat")(concatEndpoint)
54 }
5155 concatEndpoint = LoggingMiddleware(log.With(logger, "method", "Concat"))(concatEndpoint)
5256 concatEndpoint = InstrumentingMiddleware(duration.With("method", "Concat"))(concatEndpoint)
5357 }
3232
3333 // NewGRPCServer makes a set of endpoints available as a gRPC AddServer.
3434 func NewGRPCServer(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) pb.AddServer {
35 // Zipkin GRPC Server Trace can either be instantiated per gRPC method with a
36 // provided operation name or a global tracing service can be instantiated
37 // without an operation name and fed to each Go kit gRPC server as a
38 // ServerOption.
39 // In the latter case, the operation name will be the endpoint's grpc method
40 // path if used in combination with the Go kit gRPC Interceptor.
41 //
42 // In this example, we demonstrate a global Zipkin tracing service with
43 // Go kit gRPC Interceptor.
44 zipkinServer := zipkin.GRPCServerTrace(zipkinTracer)
45
4635 options := []grpctransport.ServerOption{
4736 grpctransport.ServerErrorHandler(transport.NewLogErrorHandler(logger)),
48 zipkinServer,
37 }
38
39 if zipkinTracer != nil {
40 // Zipkin GRPC Server Trace can either be instantiated per gRPC method with a
41 // provided operation name or a global tracing service can be instantiated
42 // without an operation name and fed to each Go kit gRPC server as a
43 // ServerOption.
44 // In the latter case, the operation name will be the endpoint's grpc method
45 // path if used in combination with the Go kit gRPC Interceptor.
46 //
47 // In this example, we demonstrate a global Zipkin tracing service with
48 // Go kit gRPC Interceptor.
49 options = append(options, zipkin.GRPCServerTrace(zipkinTracer))
4950 }
5051
5152 return &grpcServer{
9293 // for the entire remote instance, too.
9394 limiter := ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 100))
9495
95 // Zipkin GRPC Client Trace can either be instantiated per gRPC method with a
96 // provided operation name or a global tracing client can be instantiated
97 // without an operation name and fed to each Go kit client as ClientOption.
98 // In the latter case, the operation name will be the endpoint's grpc method
99 // path.
100 //
101 // In this example, we demonstrace a global tracing client.
102 zipkinClient := zipkin.GRPCClientTrace(zipkinTracer)
103
10496 // global client middlewares
105 options := []grpctransport.ClientOption{
106 zipkinClient,
107 }
108
97 var options []grpctransport.ClientOption
98
99 if zipkinTracer != nil {
100 // Zipkin GRPC Client Trace can either be instantiated per gRPC method with a
101 // provided operation name or a global tracing client can be instantiated
102 // without an operation name and fed to each Go kit client as ClientOption.
103 // In the latter case, the operation name will be the endpoint's grpc method
104 // path.
105 //
106 // In this example, we demonstrace a global tracing client.
107 options = append(options, zipkin.GRPCClientTrace(zipkinTracer))
108
109 }
109110 // Each individual endpoint is an grpc/transport.Client (which implements
110111 // endpoint.Endpoint) that gets wrapped with various middlewares. If you
111112 // made your own client library, you'd do this work there, so your server
3232 // NewHTTPHandler returns an HTTP handler that makes a set of endpoints
3333 // available on predefined paths.
3434 func NewHTTPHandler(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) http.Handler {
35 // Zipkin HTTP Server Trace can either be instantiated per endpoint with a
36 // provided operation name or a global tracing service can be instantiated
37 // without an operation name and fed to each Go kit endpoint as ServerOption.
38 // In the latter case, the operation name will be the endpoint's http method.
39 // We demonstrate a global tracing service here.
40 zipkinServer := zipkin.HTTPServerTrace(zipkinTracer)
41
4235 options := []httptransport.ServerOption{
4336 httptransport.ServerErrorEncoder(errorEncoder),
4437 httptransport.ServerErrorHandler(transport.NewLogErrorHandler(logger)),
45 zipkinServer,
38 }
39
40 if zipkinTracer != nil {
41 // Zipkin HTTP Server Trace can either be instantiated per endpoint with a
42 // provided operation name or a global tracing service can be instantiated
43 // without an operation name and fed to each Go kit endpoint as ServerOption.
44 // In the latter case, the operation name will be the endpoint's http method.
45 // We demonstrate a global tracing service here.
46 options = append(options, zipkin.HTTPServerTrace(zipkinTracer))
4647 }
4748
4849 m := http.NewServeMux()
8283 // for the entire remote instance, too.
8384 limiter := ratelimit.NewErroringLimiter(rate.NewLimiter(rate.Every(time.Second), 100))
8485
85 // Zipkin HTTP Client Trace can either be instantiated per endpoint with a
86 // provided operation name or a global tracing client can be instantiated
87 // without an operation name and fed to each Go kit endpoint as ClientOption.
88 // In the latter case, the operation name will be the endpoint's http method.
89 zipkinClient := zipkin.HTTPClientTrace(zipkinTracer)
90
9186 // global client middlewares
92 options := []httptransport.ClientOption{
93 zipkinClient,
87 var options []httptransport.ClientOption
88
89 if zipkinTracer != nil {
90 // Zipkin HTTP Client Trace can either be instantiated per endpoint with a
91 // provided operation name or a global tracing client can be instantiated
92 // without an operation name and fed to each Go kit endpoint as ClientOption.
93 // In the latter case, the operation name will be the endpoint's http method.
94 options = append(options, zipkin.HTTPClientTrace(zipkinTracer))
9495 }
9596
9697 // Each individual endpoint is an http/transport.Client (which implements
107108 append(options, httptransport.ClientBefore(opentracing.ContextToHTTP(otTracer, logger)))...,
108109 ).Endpoint()
109110 sumEndpoint = opentracing.TraceClient(otTracer, "Sum")(sumEndpoint)
110 sumEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Sum")(sumEndpoint)
111 if zipkinTracer != nil {
112 sumEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Sum")(sumEndpoint)
113 }
111114 sumEndpoint = limiter(sumEndpoint)
112115 sumEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{
113116 Name: "Sum",
127130 append(options, httptransport.ClientBefore(opentracing.ContextToHTTP(otTracer, logger)))...,
128131 ).Endpoint()
129132 concatEndpoint = opentracing.TraceClient(otTracer, "Concat")(concatEndpoint)
130 concatEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Concat")(concatEndpoint)
133 if zipkinTracer != nil {
134 concatEndpoint = zipkin.TraceEndpoint(zipkinTracer, "Concat")(concatEndpoint)
135 }
131136 concatEndpoint = limiter(concatEndpoint)
132137 concatEndpoint = circuitbreaker.Gobreaker(gobreaker.NewCircuitBreaker(gobreaker.Settings{
133138 Name: "Concat",
1313 "github.com/go-kit/kit/log/syslog"
1414 )
1515
16 func ExampleNewLogger_defaultPrioritySelector() {
16 func ExampleNewSyslogLogger_defaultPrioritySelector() {
1717 // Normal syslog writer
1818 w, err := gosyslog.New(gosyslog.LOG_INFO, "experiment")
1919 if err != nil {