-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.go
35 lines (28 loc) · 962 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
package influence
import (
"os"
"strconv"
"time"
)
var (
confDatabase = os.Getenv("INFLUX_DATABASE")
confHandlerTagsKey = os.Getenv("INFLUX_HTTP_HANDLER_TAGS")
confRuntimeTagsKey = os.Getenv("INFLUX_GO_RUNTIME_TAGS")
monitorAggregationMilliseconds, _ = strconv.Atoi(get(os.Getenv("INFLUX_AGGREGATION_INTERVAL"), "100"))
confMonitoringAggregationInterval = time.Duration(monitorAggregationMilliseconds) * time.Millisecond
monitorSyncMilliseconds, _ = strconv.Atoi(get(os.Getenv("INFLUX_SYNC_INTERVAL"), "1000"))
confMonitoringSyncInterval = time.Duration(monitorSyncMilliseconds) * time.Millisecond
)
const (
httpHandlerTablename = "http_response"
runtimeTablename = "go_runtime"
gcTablename = "go_gc"
)
// get is a ternary operator for string values.
// It returns first param in it is not empty string, else - returns second param.
func get(check string, dflt string) string {
if check == "" {
return dflt
}
return check
}