Add support for prometheus

This commit is contained in:
9seconds
2018-10-17 12:06:46 +03:00
parent 5f00363da5
commit 9346c11f37
7 changed files with 126 additions and 2 deletions
+5 -1
View File
@@ -38,6 +38,9 @@ type Config struct {
TagsFormat statsd.TagFormat
Enabled bool
}
Prometheus struct {
Prefix string
}
Secret []byte
AdTag []byte
@@ -116,7 +119,7 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
bindIP, publicIPv4, publicIPv6, statsIP net.IP,
bindPort, publicIPv4Port, publicIPv6Port, statsPort, statsdPort uint16,
statsdIP, statsdNetwork, statsdPrefix, statsdTagsFormat string,
statsdTags map[string]string,
statsdTags map[string]string, prometheusPrefix string,
secureOnly bool,
secret, adtag []byte) (*Config, error) {
secureMode := secureOnly
@@ -174,6 +177,7 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
ReadBufferSize: int(readBufferSize),
WriteBufferSize: int(writeBufferSize),
}
conf.Prometheus.Prefix = prometheusPrefix
if statsdIP != "" {
conf.StatsD.Enabled = true