Skip to content

Commit

Permalink
Switch canary to gRPC (#4570)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Oct 14, 2021
1 parent 2719202 commit a0ccc85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions canary/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
"sync"
"time"

"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient"
apiv1 "go.uber.org/cadence/.gen/proto/api/v1"
"go.uber.org/cadence/compatibility"
"go.uber.org/yarpc"
"go.uber.org/yarpc/transport/tchannel"
"go.uber.org/yarpc/transport/grpc"
"go.uber.org/zap"

"github.com/uber/cadence/common/log/loggerimpl"
Expand Down Expand Up @@ -56,17 +57,10 @@ func NewCanaryRunner(cfg *Config) (Runnable, error) {
cfg.Cadence.HostNameAndPort = CadenceLocalHostPort
}

ch, err := tchannel.NewChannelTransport(
tchannel.ServiceName(CanaryServiceName),
)
if err != nil {
return nil, fmt.Errorf("failed to create transport channel: %v", err)
}

dispatcher := yarpc.NewDispatcher(yarpc.Config{
Name: CanaryServiceName,
Outbounds: yarpc.Outbounds{
cfg.Cadence.ServiceName: {Unary: ch.NewSingleOutbound(cfg.Cadence.HostNameAndPort)},
cfg.Cadence.ServiceName: {Unary: grpc.NewTransport().NewSingleOutbound(cfg.Cadence.HostNameAndPort)},
},
})

Expand All @@ -75,10 +69,16 @@ func NewCanaryRunner(cfg *Config) (Runnable, error) {
return nil, fmt.Errorf("failed to create outbound transport channel: %v", err)
}

clientConfig := dispatcher.ClientConfig(cfg.Cadence.ServiceName)
runtimeContext := NewRuntimeContext(
logger,
metricsScope,
workflowserviceclient.New(dispatcher.ClientConfig(cfg.Cadence.ServiceName)),
compatibility.NewThrift2ProtoAdapter(
apiv1.NewDomainAPIYARPCClient(clientConfig),
apiv1.NewWorkflowAPIYARPCClient(clientConfig),
apiv1.NewWorkerAPIYARPCClient(clientConfig),
apiv1.NewVisibilityAPIYARPCClient(clientConfig),
),
)

return &canaryRunner{
Expand Down
2 changes: 1 addition & 1 deletion config/canary/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ canary:

cadence:
service: "cadence-frontend"
host: "127.0.0.1:7933"
host: "127.0.0.1:7833"

0 comments on commit a0ccc85

Please sign in to comment.