event: change counter type to int64
Counter metric values can be negative. For example, you might be
counting the net number of something.
Change the type from unit64 to int64.
Change-Id: I85edb8f1440877697d63cd8788659de3c88e2e17
Reviewed-on: https://go-review.googlesource.com/c/exp/+/330030
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/event/metric.go b/event/metric.go
index a71f1f1..a603a10 100644
--- a/event/metric.go
+++ b/event/metric.go
@@ -75,13 +75,12 @@
return c.MetricDescriptor
}
-// Record converts its argument into a Value and returns a MetricValue with the
-// receiver and the value. It is intended to be used as an argument to
-// Builder.Metric.
-func (c *Counter) Record(ctx context.Context, v uint64, labels ...Label) {
+// Record delivers a metric event with the given metric, value and labels to the
+// exporter in the context.
+func (c *Counter) Record(ctx context.Context, v int64, labels ...Label) {
ev := New(ctx, MetricKind)
if ev != nil {
- record(ev, c, Uint64(MetricVal, v))
+ record(ev, c, Int64(MetricVal, v))
ev.Labels = append(ev.Labels, labels...)
ev.Deliver()
}