Skip to content

Commit

Permalink
Fix duration metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Dec 18, 2024
1 parent 0c9e9ec commit b6ef80b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backends/rapidpro/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ func (s *Stats) ToMetrics() []types.MetricDatum {

for typ, d := range s.IncomingDuration { // convert to averages
avgTime := float64(d) / float64(s.IncomingRequests[typ])
metrics = append(metrics, cwatch.Datum("IncomingDuration", float64(avgTime), types.StandardUnitCount, cwatch.Dimension("ChannelType", string(typ))))
metrics = append(metrics, cwatch.Datum("IncomingDuration", avgTime/float64(time.Second), types.StandardUnitSeconds, cwatch.Dimension("ChannelType", string(typ))))
}

metrics = append(metrics, s.OutgoingSends.metrics("OutgoingSends")...)
metrics = append(metrics, s.OutgoingErrors.metrics("OutgoingErrors")...)

for typ, d := range s.OutgoingDuration { // convert to averages
avgTime := float64(d) / float64(s.OutgoingSends[typ]+s.OutgoingErrors[typ])
metrics = append(metrics, cwatch.Datum("OutgoingDuration", avgTime, types.StandardUnitSeconds, cwatch.Dimension("ChannelType", string(typ))))
metrics = append(metrics, cwatch.Datum("OutgoingDuration", avgTime/float64(time.Second), types.StandardUnitSeconds, cwatch.Dimension("ChannelType", string(typ))))
}

metrics = append(metrics, cwatch.Datum("ContactsCreated", float64(s.ContactsCreated), types.StandardUnitCount))
Expand Down

0 comments on commit b6ef80b

Please sign in to comment.