diff --git a/gauge.go b/gauge.go index 4b93da1..ff2bda5 100644 --- a/gauge.go +++ b/gauge.go @@ -37,7 +37,7 @@ func (g *Gauge) Get() float64 { func (g *Gauge) marshalTo(prefix string, w io.Writer) { v := g.f() if float64(int64(v)) == v { - // Marshal integer values without scientific notations + // Marshal integer values without scientific notation fmt.Fprintf(w, "%s %d\n", prefix, int64(v)) } else { fmt.Fprintf(w, "%s %g\n", prefix, v) diff --git a/summary.go b/summary.go index def1f4e..509ce4a 100644 --- a/summary.go +++ b/summary.go @@ -109,7 +109,12 @@ func (sm *Summary) marshalTo(prefix string, w io.Writer) { if count > 0 { name, filters := splitMetricName(prefix) - fmt.Fprintf(w, "%s_sum%s %g\n", name, filters, sum) + if float64(int64(sum)) == sum { + // Marshal integer sum without scientific notation + fmt.Fprintf(w, "%s_sum%s %d\n", name, filters, int64(sum)) + } else { + fmt.Fprintf(w, "%s_sum%s %g\n", name, filters, sum) + } fmt.Fprintf(w, "%s_count%s %d\n", name, filters, count) } }