Skip to content

Commit

Permalink
Merge pull request #107 from kristinaspring/feature/caduceus-configur…
Browse files Browse the repository at this point in the history
…ation

Added/Modified Configuration Options
  • Loading branch information
johnabass authored Oct 26, 2018
2 parents dc0dbe6 + 1de18de commit ce1a924
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 25 deletions.
14 changes: 9 additions & 5 deletions example-caduceus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ soa:

numWorkerThreads: 10
jobQueueSize: 10
senderNumWorkersPerSender: 10
senderQueueSizePerSender: 50
senderCutOffPeriod: 30
senderLinger: 180
senderClientTimeout: 60
sender:
numWorkersPerSender: 10
queueSizePerSender: 50
cutOffPeriod: 30s
linger: 180s
clientTimeout: 60s
deliveryRetries: 1
deliveryInterval: 10ms
responseHeaderTimeout: 10s
profilerFrequency: 15
profilerDuration: 15
profilerQueueSize: 100
Expand Down
21 changes: 10 additions & 11 deletions src/caduceus/caduceus.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,23 @@ func caduceus(arguments []string) int {

tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
MaxIdleConnsPerHost: caduceusConfig.SenderNumWorkersPerSender,
ResponseHeaderTimeout: 10 * time.Second, // TODO Make this configurable
MaxIdleConnsPerHost: caduceusConfig.Sender.NumWorkersPerSender,
ResponseHeaderTimeout: caduceusConfig.Sender.ResponseHeaderTimeout,
IdleConnTimeout: caduceusConfig.Sender.IdleConnTimeout,
}

timeout := time.Duration(caduceusConfig.SenderClientTimeout) * time.Second

caduceusSenderWrapper, err := SenderWrapperFactory{
NumWorkersPerSender: caduceusConfig.SenderNumWorkersPerSender,
QueueSizePerSender: caduceusConfig.SenderQueueSizePerSender,
CutOffPeriod: time.Duration(caduceusConfig.SenderCutOffPeriod) * time.Second,
Linger: time.Duration(caduceusConfig.SenderLinger) * time.Second,
DeliveryRetries: 1, // TODO Make this configurable
DeliveryInterval: 10 * time.Millisecond, // TODO Make this configurable
NumWorkersPerSender: caduceusConfig.Sender.NumWorkersPerSender,
QueueSizePerSender: caduceusConfig.Sender.QueueSizePerSender,
CutOffPeriod: caduceusConfig.Sender.CutOffPeriod,
Linger: caduceusConfig.Sender.Linger,
DeliveryRetries: caduceusConfig.Sender.DeliveryRetries,
DeliveryInterval: caduceusConfig.Sender.DeliveryInterval,
MetricsRegistry: metricsRegistry,
Logger: logger,
Sender: (&http.Client{
Transport: tr,
Timeout: timeout,
Timeout: caduceusConfig.Sender.ClientTimeout,
}).Do,
}.New()

Expand Down
27 changes: 18 additions & 9 deletions src/caduceus/caduceus_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,29 @@ import (
"github.com/Comcast/webpa-common/wrp"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/metrics"
"time"
)

// Below is the struct we're using to contain the data from a provided config file
// TODO: Try to figure out how to make bucket ranges configurable
type CaduceusConfig struct {
AuthHeader []string
NumWorkerThreads int
JobQueueSize int
SenderNumWorkersPerSender int
SenderQueueSizePerSender int
SenderCutOffPeriod int
SenderLinger int
SenderClientTimeout int
JWTValidators []JWTValidator
AuthHeader []string
NumWorkerThreads int
JobQueueSize int
Sender SenderConfig
JWTValidators []JWTValidator
}

type SenderConfig struct {
NumWorkersPerSender int
QueueSizePerSender int
CutOffPeriod time.Duration
Linger time.Duration
ClientTimeout time.Duration
ResponseHeaderTimeout time.Duration
IdleConnTimeout time.Duration
DeliveryRetries int
DeliveryInterval time.Duration
}

type JWTValidator struct {
Expand Down

0 comments on commit ce1a924

Please sign in to comment.