Skip to content

Commit

Permalink
modify instanceID to use HOSTNAME (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy Budiono Hermawan authored Jan 20, 2023
1 parent 381adf7 commit 009a7ad
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions metrics/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ func (p *pusher) Close() error {
}

func instanceID() string {
instance := os.Getenv("DYNO")
if instance == "" {
instance = os.Getenv("INSTANCE_ID")
envKeysToTry := []string{"DYNO", "INSTANCE_ID", "HOSTNAME"}
for _, key := range envKeysToTry {
curr := os.Getenv(key)
if curr != "" {
return curr
}
}
if instance == "" {
instance = "local"
}
return instance
return "local"
}

0 comments on commit 009a7ad

Please sign in to comment.