internal/telemetry: add a noop exporter benchmark

This has the exporter registered but doing nothing, to measure the basic cost of
having any exporter without any specific exporter costs.
Specifically at the moment this measures the cost of filling in the time on the
event and building the TagMap that is passed down.

Change-Id: Iaae5659e3de9b871dc281c509fa2ee9c3e1d049a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/226357
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/internal/telemetry/bench_test.go b/internal/telemetry/bench_test.go
index ee1921b..df0f1ea 100644
--- a/internal/telemetry/bench_test.go
+++ b/internal/telemetry/bench_test.go
@@ -2,6 +2,7 @@
 
 import (
 	"context"
+	"io/ioutil"
 	"log"
 	"testing"
 
@@ -108,6 +109,11 @@
 
 	event.SetExporter(noopExporter)
 	for _, t := range benchmarks {
+		b.Run(t.name+"Noop", t.test)
+	}
+
+	event.SetExporter(export.Spans(export.LogWriter(ioutil.Discard, false)))
+	for _, t := range benchmarks {
 		b.Run(t.name, t.test)
 	}
 }
@@ -137,13 +143,9 @@
 }
 
 func init() {
-	log.SetOutput(new(noopWriter))
+	log.SetOutput(ioutil.Discard)
 }
 
-type noopWriter int
-
-func (nw *noopWriter) Write(b []byte) (int, error) {
-	return len(b), nil
+func noopExporter(ctx context.Context, ev event.Event, tagMap event.TagMap) context.Context {
+	return ctx
 }
-
-var noopExporter = export.Spans(export.LogWriter(new(noopWriter), false))