Skip to content

Commit

Permalink
Change host by hostname in statsd tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
cscatolini committed May 10, 2018
1 parent cb2f601 commit 672c3ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions metrics/statsd_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *StatsdReporter) ReportLatency(value time.Duration, route, typ string, e
fmt.Sprintf("type:%s", typ),
fmt.Sprintf("error:%t", errored),
fmt.Sprintf("serverType:%s", s.serverType),
fmt.Sprintf("host:%s", s.hostname),
fmt.Sprintf("hostname:%s", s.hostname),
}

return s.client.Timing("response_time_ms", value, tags, s.rate)
Expand All @@ -90,7 +90,7 @@ func (s *StatsdReporter) ReportLatency(value time.Duration, route, typ string, e
func (s *StatsdReporter) ReportCount(value int, metric string, tags ...string) error {
fullTags := []string{
fmt.Sprintf("serverType:%s", s.serverType),
fmt.Sprintf("host:%s", s.hostname),
fmt.Sprintf("hostname:%s", s.hostname),
}
if len(tags) > 0 {
fullTags = append(fullTags, tags...)
Expand Down
4 changes: 2 additions & 2 deletions metrics/statsd_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestReportLatency(t *testing.T) {
assert.Contains(t, tags, fmt.Sprintf("type:%s", expectedType))
assert.Contains(t, tags, fmt.Sprintf("error:%t", expectedErrored))
assert.Contains(t, tags, fmt.Sprintf("serverType:%s", sr.serverType))
assert.Contains(t, tags, fmt.Sprintf("host:%s", sr.hostname))
assert.Contains(t, tags, fmt.Sprintf("hostname:%s", sr.hostname))
})

err = sr.ReportLatency(expectedDuration, expectedRoute, expectedType, expectedErrored)
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestReportCount(t *testing.T) {
assert.Contains(t, tags, tag)
}
assert.Contains(t, tags, fmt.Sprintf("serverType:%s", sr.serverType))
assert.Contains(t, tags, fmt.Sprintf("host:%s", sr.hostname))
assert.Contains(t, tags, fmt.Sprintf("hostname:%s", sr.hostname))
})

err = sr.ReportCount(expectedCount, expectedMetric, customTags...)
Expand Down

0 comments on commit 672c3ac

Please sign in to comment.