Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connCheckTimeout as flag #911

Merged
merged 1 commit into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cmd/agent/app/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package app
import (
"fmt"
"net/http"
"time"

"github.com/apache/thrift/lib/go/thrift"
"github.com/pkg/errors"
Expand All @@ -36,10 +37,11 @@ import (
)

const (
defaultQueueSize = 1000
defaultMaxPacketSize = 65000
defaultServerWorkers = 10
defaultMinPeers = 3
defaultQueueSize = 1000
defaultMaxPacketSize = 65000
defaultServerWorkers = 10
defaultMinPeers = 3
defaultConnCheckTimeout = 250 * time.Millisecond

defaultHTTPServerHostPort = ":5778"

Expand Down
6 changes: 6 additions & 0 deletions cmd/agent/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
collectorHostPort = "collector.host-port"
httpServerHostPort = "http-server.host-port"
discoveryMinPeers = "discovery.min-peers"
discoveryConnCheckTimeout = "discovery.conn-check-timeout"
)

var defaultProcessors = []struct {
Expand Down Expand Up @@ -63,6 +64,10 @@ func AddFlags(flags *flag.FlagSet) {
discoveryMinPeers,
defaultMinPeers,
"if using service discovery, the min number of connections to maintain to the backend")
flags.Duration(
discoveryConnCheckTimeout,
defaultConnCheckTimeout,
"sets the timeout used when establishing new connections")
}

// InitFromViper initializes Builder with properties retrieved from Viper.
Expand All @@ -84,5 +89,6 @@ func (b *Builder) InitFromViper(v *viper.Viper) *Builder {
}
b.HTTPServer.HostPort = v.GetString(httpServerHostPort)
b.DiscoveryMinPeers = v.GetInt(discoveryMinPeers)
b.ConnCheckTimeout = v.GetDuration(discoveryConnCheckTimeout)
return b
}
9 changes: 8 additions & 1 deletion cmd/agent/app/reporter/tchannel/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package tchannel

import (
"time"

"github.com/pkg/errors"
"github.com/uber/jaeger-lib/metrics"
"github.com/uber/tchannel-go"
Expand Down Expand Up @@ -44,6 +46,9 @@ type Builder struct {
// responds to.
CollectorServiceName string `yaml:"collectorServiceName"`

// ConnCheckTimeout is the timeout used when establishing new connections.
ConnCheckTimeout time.Duration

discoverer discovery.Discoverer
notifier discovery.Notifier
channel *tchannel.Channel
Expand Down Expand Up @@ -92,7 +97,9 @@ func (b *Builder) enableDiscovery(channel *tchannel.Channel, logger *zap.Logger)
peers := subCh.Peers()
return peerlistmgr.New(peers, b.discoverer, b.notifier,
peerlistmgr.Options.MinPeers(defaultInt(b.DiscoveryMinPeers, defaultMinPeers)),
peerlistmgr.Options.Logger(logger))
peerlistmgr.Options.Logger(logger),
peerlistmgr.Options.ConnCheckTimeout(b.ConnCheckTimeout),
)
}

// CreateReporter creates the TChannel-based Reporter
Expand Down