Skip to content

Commit

Permalink
fixes statsd prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
christianparpart committed Apr 8, 2016
1 parent 6f4e7c3 commit 75066c0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ import (
type Tracker struct {
Name string
SessionTTL time.Duration
StatsdPrefix string
Debug bool
buckets map[string]*time.Timer
bucketMutex sync.Mutex
sessionCount int64
currentBucket int
statsdClient *UdpClient
statsdPrefix string
statsdTicker *time.Ticker
}

func NewTracker(name string, sessionTTL time.Duration, statsdAddr string, statsdPrefix string, debug bool) (*Tracker, error) {
tracker := &Tracker{Name: name, SessionTTL: sessionTTL, Debug: debug}
tracker := &Tracker{Name: name,
SessionTTL: sessionTTL,
StatsdPrefix: statsdPrefix,
Debug: debug,
}

if len(statsdAddr) > 0 {
udpClient, err := NewUdpClient(statsdAddr)
Expand Down Expand Up @@ -50,7 +54,7 @@ func (tracker *Tracker) flushReport() {
count := tracker.GetCount()
log.Printf("Tracking summary for %v sessions: %v\n", tracker.Name, count)
if tracker.statsdClient != nil {
tracker.statsdClient.Sendf("%v.%v:%v|c", tracker.statsdPrefix, tracker.Name, count)
tracker.statsdClient.Sendf("%v.%v:%v|c", tracker.StatsdPrefix, tracker.Name, count)
}
}

Expand Down

0 comments on commit 75066c0

Please sign in to comment.