Add metrics

This commit is contained in:
2021-11-01 21:31:24 +01:00
parent 1e7a55c852
commit 0e792d2416
8 changed files with 544 additions and 19 deletions

View File

@@ -21,6 +21,7 @@ type Config struct {
HTTPListenAddr string `toml:"HTTPListenAddr"`
HTTPAccessLogEnable bool `toml:"HTTPAccessLogEnable"`
LogLevel string `toml:"LogLevel"`
MetricsEnable bool `toml:"MetricsEnable"`
}
type InvalidValueError struct {
@@ -89,6 +90,13 @@ func (c *Config) UpdateFromEnv() error {
}
}
if metricsEnable, found := os.LookupEnv("DOGTAMER_METRICSENABLE"); found {
switch strings.ToUpper(metricsEnable) {
case "TRUE", "YES", "ENABLE":
c.MetricsEnable = true
}
}
return c.Verify()
}