-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.go
43 lines (36 loc) · 945 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package zipkin
import (
"log"
"os"
"time"
)
// Config struct stores the configuration used to create a new ZipKin server. All fields
// are optional. Comment following each field indicates the default value that will be
// used.
type Config struct {
ListenAddress string // "0.0.0.0:9410"
InputBufferSize int // 32
OutputBufferSize int // 32
MaxConcurrentTraces int // 128
TraceTimeout time.Duration // 3 * time.Second
Logger *log.Logger // log.New(os.Stderr)
}
func fillDefaultConfig(c *Config) *Config {
if c == nil {
c = &Config{}
}
if c.ListenAddress == "" {
c.ListenAddress = "0.0.0.0:9410"
}
if c.MaxConcurrentTraces == 0 {
c.MaxConcurrentTraces = 128
}
if c.TraceTimeout == 0 {
c.TraceTimeout = 3 * time.Second
}
if c.Logger == nil {
// same as `var std` in stdlib src/log/log.go
c.Logger = log.New(os.Stderr, "", log.LstdFlags)
}
return c
}