Skip to content

Commit

Permalink
enable hostname statsd host key (#2429)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangaechu authored Aug 26, 2022
1 parent 5bf7c93 commit 94c81ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion server/core/config/raw/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (s *Statsd) Validate() error {
return validation.ValidateStruct(s,
validation.Field(&s.Host, validation.Required),
validation.Field(&s.Port, validation.Required),
validation.Field(&s.Host, is.IP),
validation.Field(&s.Host, is.Host),
validation.Field(&s.Port, is.Int))
}

Expand Down
20 changes: 10 additions & 10 deletions server/core/config/raw/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ prometheus:
"prometheus": {
"endpoint": "/metrics"
}
}
}
`

var result raw.Metrics
Expand All @@ -60,6 +60,15 @@ func TestMetrics_Validate_Success(t *testing.T) {
},
},
},
{
description: "success with stats config using hostname",
subject: raw.Metrics{
Statsd: &raw.Statsd{
Host: "localhost",
Port: "8125",
},
},
},
{
description: "missing stats",
},
Expand Down Expand Up @@ -122,15 +131,6 @@ func TestMetrics_Validate_Error(t *testing.T) {
},
},
},
{
description: "invalid host",
subject: raw.Metrics{
Statsd: &raw.Statsd{
Host: "127.0.1",
Port: "8125",
},
},
},
{
description: "invalid endpoint",
subject: raw.Metrics{
Expand Down

0 comments on commit 94c81ea

Please sign in to comment.