Skip to content

Commit

Permalink
add Count case
Browse files Browse the repository at this point in the history
  • Loading branch information
ajatprabha committed Jul 1, 2019
1 parent ec32050 commit eb99107
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/metrics/statsd_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func InitializeStatsdCollector(config *StatsdCollectorConfig, collectorName stri
return nil
}

var formatter = func(on string) string {
func formatter(on string) string {
return fmt.Sprintf("%s.%s", instance.collectorName, on)
}

Expand All @@ -70,6 +70,10 @@ func Update(updateOption UpdateOption) {
break
case Gauge:
err = instance.client.Gauge(formatter(updateOption.Name), int64(updateOption.NumValue), instance.sampleRate)
break
case Count:
err = instance.client.Inc(formatter(updateOption.Name), 1, instance.sampleRate)
break
}
if err != nil {
logger.Error(err)
Expand Down

0 comments on commit eb99107

Please sign in to comment.