Skip to content

Commit

Permalink
Merge pull request #178 from checkr/zz/add-kafka-data-recorder-incr
Browse files Browse the repository at this point in the history
Add kafka data recorder dd metrics
  • Loading branch information
zhouzhuojie authored Oct 10, 2018
2 parents 8c5b3a5 + fdcb664 commit 3b41d74
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/handler/data_recorder_kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/x509"
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"strings"
"time"
Expand Down Expand Up @@ -106,6 +107,21 @@ func (k *kafkaRecorder) AsyncRecord(r *models.EvalResult) {
Value: kr,
Timestamp: time.Now().UTC(),
}

logKafkaAsyncRecordToDatadog(r)
}

var logKafkaAsyncRecordToDatadog = func(r *models.EvalResult) {
if config.Global.StatsdClient == nil {
return
}
config.Global.StatsdClient.Incr(
"data_recorder.kafka",
[]string{
fmt.Sprintf("FlagID:%d", util.SafeUint(r.FlagID)),
},
float64(1),
)
}

type kafkaEvalResult struct {
Expand Down

0 comments on commit 3b41d74

Please sign in to comment.