Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
Add config for metrics port (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
corinnekrych authored and sbose78 committed Nov 9, 2018
1 parent 746ab9a commit 46a6522
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ sentry:
server:
host: "localhost"
port: 8099
# This section defines the url used by metrics.
Metrics:
host: "localhost"
port: 8099
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,14 @@ func main() {
if configuration.Metrics.Port == configuration.Server.Port {
http.Handle("/metrics", promhttp.Handler())
} else {

go func(metricAddress string) {
mx := http.NewServeMux()
mx.Handle("/metrics", promhttp.Handler())
if err := http.ListenAndServe(metricAddress, mx); err != nil {
service.LogError("startup", "err", err)
}
}(":" + strconv.Itoa(configuration.Server.Port)) // TODO FIX CONFIG
}(":" + strconv.Itoa(configuration.Metrics.Port)) // if no port defined in config file, pick one available.
}

// Start service
Expand Down

0 comments on commit 46a6522

Please sign in to comment.