Skip to content

Commit

Permalink
Feat(GPX-675): Metrics Port (#62)
Browse files Browse the repository at this point in the history
+ Switched from magically assigning metrics port to be a config option
+ changed a debug message
  • Loading branch information
Lucostus committed Jun 26, 2023
1 parent 460f5e2 commit 7b66722
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions configs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ proxy:
insecure_skip_verify: false
log_tokens: false
port: 8080
metrics_port: 8081
host: localhost
tenant_labels:
thanos: namespace
Expand Down
2 changes: 1 addition & 1 deletion init.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func init() {
Logger.Info("Config ", zap.Any("cfg", Cfg))
ServiceAccountToken = Cfg.Dev.ServiceAccountToken
if !strings.HasSuffix(os.Args[0], ".test") {
fmt.Println("Not in test mode")
Logger.Debug("Not in test mode")
InitJWKS()
if !Cfg.Dev.Enabled {
sa, err := os.ReadFile("/run/secrets/kubernetes.io/serviceaccount/token")
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
mux.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index))

go func() {
if err := http.ListenAndServe(fmt.Sprintf("%s:%d", Cfg.Proxy.Host, Cfg.Proxy.Port+1), mux); err != nil {
if err := http.ListenAndServe(fmt.Sprintf("%s:%d", Cfg.Proxy.Host, Cfg.Proxy.MetricsPort), mux); err != nil {
Logger.Panic("Error while serving metrics", zap.Error(err))
}
}()
Expand Down
1 change: 1 addition & 0 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Config struct {
InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
LogTokens bool `mapstructure:"log_tokens"`
Port int `mapstructure:"port"`
MetricsPort int `mapstructure:"metrics_port"`
Host string `mapstructure:"host"`
TenantLabels struct {
Thanos string `mapstructure:"thanos"`
Expand Down

0 comments on commit 7b66722

Please sign in to comment.