1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:34:40 -07:00

internal/telemetry/export/ocagent: update usages of BucketOptions to use pointers

This change updates initializations of DistributionValue to pass in a pointer for
BucketOptions rather than a value so that the custom MarshalJSON for
*BucketOptionsExplicit will be called when marshalling distributions.

Updates golang/go#33819

Change-Id: I6d1a393dfa67d626bf5cdd2cfbc0c931d376f60c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208401
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Nathan Dias 2019-11-22 00:59:40 -06:00 committed by Emmanuel Odeke
parent df8e87c2ce
commit f774e2e2e5
3 changed files with 12 additions and 9 deletions

View File

@ -190,7 +190,7 @@ func distributionToPoints(counts []int64, count int64, sum float64, bucketBounds
Sum: sum,
// TODO: SumOfSquaredDeviation?
Buckets: buckets,
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: bucketBounds,
},
},

View File

@ -451,7 +451,7 @@ func TestDataToTimeseries(t *testing.T) {
Count: 3,
},
},
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: []float64{
0, 5, 10,
},
@ -502,7 +502,7 @@ func TestDataToTimeseries(t *testing.T) {
Count: 2,
},
},
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: []float64{
0, 5,
},
@ -753,7 +753,7 @@ func TestDataToPoints(t *testing.T) {
Count: 3,
},
},
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: []float64{
0, 5, 10,
},
@ -785,7 +785,7 @@ func TestDataToPoints(t *testing.T) {
Count: 6,
},
},
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: []float64{
0, 5, 10,
},
@ -817,7 +817,7 @@ func TestDataToPoints(t *testing.T) {
Count: 3,
},
},
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: []float64{
0, 5, 10,
},
@ -849,7 +849,7 @@ func TestDataToPoints(t *testing.T) {
Count: 9,
},
},
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: []float64{
0, 5, 10,
},
@ -916,7 +916,7 @@ func TestDistributionToPoints(t *testing.T) {
Count: 3,
},
},
BucketOptions: wire.BucketOptionsExplicit{
BucketOptions: &wire.BucketOptionsExplicit{
Bounds: []float64{
0, 5, 10,
},

View File

@ -146,7 +146,10 @@ type BucketOptions interface {
tagBucketOptions()
}
func (BucketOptionsExplicit) tagBucketOptions() {}
func (*BucketOptionsExplicit) tagBucketOptions() {}
var _ BucketOptions = (*BucketOptionsExplicit)(nil)
var _ json.Marshaler = (*BucketOptionsExplicit)(nil)
// Declared for the purpose of custom JSON marshalling without cycles.
type bucketOptionsExplicitAlias BucketOptionsExplicit