Skip to content

Commit

Permalink
Add gRPC parameters to the veneur-proxy configuration. (#983)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavdugar-stripe authored Aug 25, 2022
1 parent ef06038 commit 7cb32d9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
12 changes: 10 additions & 2 deletions proxy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ type Config struct {
DiscoveryInterval time.Duration `yaml:"discovery_interval"`
ForwardAddresses []string `yaml:"forward_addresses"`
ForwardService string `yaml:"forward_service"`
GrpcAddress string `yaml:"grpc_address"`
Http struct {
GrpcServer struct {
ConnectionTimeout time.Duration `yaml:"connection_timeout"`
MaxConnectionIdle time.Duration `yaml:"max_connection_idle"`
MaxConnectionAge time.Duration `yaml:"max_connection_age"`
MaxConnectionAgeGrace time.Duration `yaml:"max_connection_age_grace"`
PingTimeout time.Duration `yaml:"ping_timeout"`
KeepaliveTimeout time.Duration `yaml:"keepalive_timeout"`
} `yaml:"grpc_server"`
GrpcAddress string `yaml:"grpc_address"`
Http struct {
EnableConfig bool `yaml:"enable_config"`
EnableProfiling bool `yaml:"enable_profiling"`
} `yaml:"http"`
Expand Down
18 changes: 14 additions & 4 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/stripe/veneur/v14/proxy/handlers"
"github.com/stripe/veneur/v14/scopedstatsd"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
)

type CreateParams struct {
Expand Down Expand Up @@ -58,10 +59,19 @@ func Create(params *CreateParams) *Proxy {
forwardAddresses: params.Config.ForwardAddresses,
forwardService: params.Config.ForwardService,
grpcAddress: params.Config.GrpcAddress,
grpcServer: grpc.NewServer(grpc.StatsHandler(&grpcstats.StatsHandler{
IsClient: false,
Statsd: params.Statsd,
})),
grpcServer: grpc.NewServer(
grpc.ConnectionTimeout(params.Config.GrpcServer.ConnectionTimeout),
grpc.KeepaliveParams(keepalive.ServerParameters{
MaxConnectionIdle: params.Config.GrpcServer.MaxConnectionIdle,
MaxConnectionAge: params.Config.GrpcServer.MaxConnectionAge,
MaxConnectionAgeGrace: params.Config.GrpcServer.MaxConnectionAgeGrace,
Time: params.Config.GrpcServer.PingTimeout,
Timeout: params.Config.GrpcServer.KeepaliveTimeout,
}),
grpc.StatsHandler(&grpcstats.StatsHandler{
IsClient: false,
Statsd: params.Statsd,
})),
handlers: &handlers.Handlers{
Destinations: params.Destinations,
HealthcheckContext: params.HealthcheckContext,
Expand Down

0 comments on commit 7cb32d9

Please sign in to comment.