mirror of
https://github.com/golang/go
synced 2024-11-05 23:26:18 -07:00
36db529775
This adds variants of the main event functions that take specific numbers of tags, rather than a tag slice. This reduces the allocation cost when using those functions with no exporter to zero. name old time/op new time/op delta /Baseline-8 158ns ± 7% 154ns ± 1% ~ /StdLog-8 6.90µs ± 1% 6.83µs ± 1% ~ /LogNoExporter-8 1.78µs ± 5% 1.20µs ± 3% -32.37% /TraceNoExporter-8 3.11µs ± 3% 2.48µs ± 2% -20.39% /StatsNoExporter-8 3.18µs ± 5% 1.87µs ± 3% -41.16% /Log-8 46.8µs ± 2% 44.8µs ± 1% -4.33% /Trace-8 55.1µs ± 5% 54.3µs ± 3% ~ /Stats-8 15.8µs ± 3% 13.4µs ± 1% -15.00% name old alloc/op new alloc/op delta /Baseline-8 0.00B 0.00B ~ /StdLog-8 552B ± 0% 552B ± 0% ~ /LogNoExporter-8 1.02kB ± 0% 0.00kB -100.00% /TraceNoExporter-8 1.54kB ± 0% 0.51kB ± 0% -66.67% /StatsNoExporter-8 2.05kB ± 0% 0.00kB -100.00% /Log-8 26.0kB ± 0% 24.0kB ± 0% -7.87% /Trace-8 28.7kB ± 0% 27.1kB ± 0% ~ /Stats-8 13.3kB ± 0% 10.2kB ± 0% -23.08% name old allocs/op new allocs/op delta /Baseline-8 0.00 0.00 ~ /StdLog-8 30.0 ± 0% 30.0 ± 0% ~ /LogNoExporter-8 16.0 ± 0% 0.0 -100.00% /TraceNoExporter-8 32.0 ± 0% 16.0 ± 0% -50.00% /StatsNoExporter-8 32.0 ± 0% 0.0 -100.00% /Log-8 430 ± 0% 382 ± 0% -11.16% /Trace-8 496 ± 0% 464 ± 0% -6.45% /Stats-8 192 ± 0% 128 ± 0% -33.33% Change-Id: I629c0d506ab07de6f12b0acbecfc7407f59a4285 Reviewed-on: https://go-review.googlesource.com/c/tools/+/225580 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Robert Findley <rfindley@google.com>
30 lines
991 B
Go
30 lines
991 B
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package event
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// Label sends a label event to the exporter with the supplied tags.
|
|
func Label(ctx context.Context, tags ...Tag) context.Context {
|
|
return dispatch(ctx, makeEvent(LabelType, sTags{}, tags))
|
|
}
|
|
|
|
// Label1 sends a label event to the exporter with the supplied tags.
|
|
func Label1(ctx context.Context, t1 Tag) context.Context {
|
|
return dispatch(ctx, makeEvent(LabelType, sTags{t1}, nil))
|
|
}
|
|
|
|
// Label2 sends a label event to the exporter with the supplied tags.
|
|
func Label2(ctx context.Context, t1, t2 Tag) context.Context {
|
|
return dispatch(ctx, makeEvent(LabelType, sTags{t1, t2}, nil))
|
|
}
|
|
|
|
// Label3 sends a label event to the exporter with the supplied tags.
|
|
func Label3(ctx context.Context, t1, t2, t3 Tag) context.Context {
|
|
return dispatch(ctx, makeEvent(LabelType, sTags{t1, t2, t3}, nil))
|
|
}
|