Skip to content

Commit

Permalink
fix + add total counters
Browse files Browse the repository at this point in the history
- fix throughput for elasticsearch output stats
- add total throughput counters
  • Loading branch information
urso committed May 25, 2016
1 parent cc01f55 commit ea8cb1e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions module/beats/generatorbeat/generatorbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type beatStats struct {
KafkaFail int64 `json:"libbeatKafkaPublishedButNotAckedEvents"`
ESSuccess int64 `json:"libbeatEsPublishedAndAckedEvents"`
ESFail int64 `json:"libbeatEsPublishedButNotAckedEvents"`
TotalSuccess int64
TotalFail int64
}

func init() {
Expand Down Expand Up @@ -72,6 +74,8 @@ func (m *metricSet) Fetch() (common.MapStr, error) {
m.reset()
return nil, err
}
stats.TotalSuccess = stats.LogstashSuccess + stats.KafkaSuccess + stats.ESSuccess
stats.TotalFail = stats.LogstashFail + stats.KafkaFail + stats.ESFail

var event common.MapStr
if !m.statsLast.IsZero() {
Expand All @@ -93,8 +97,12 @@ func (m *metricSet) Fetch() (common.MapStr, error) {
"fail": delta(stats.KafkaFail, old.KafkaFail),
},
"es": common.MapStr{
"success": delta(stats.ESSuccess, stats.ESSuccess),
"fail": delta(stats.ESFail, stats.ESFail),
"success": delta(stats.ESSuccess, old.ESSuccess),
"fail": delta(stats.ESFail, old.ESFail),
},
"total": common.MapStr{
"success": delta(stats.TotalSuccess, old.TotalSuccess),
"fail": delta(stats.TotalFail, old.TotalFail),
},
}
}
Expand Down

0 comments on commit ea8cb1e

Please sign in to comment.