File tree 3 files changed +7
-9
lines changed
3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -56,11 +56,7 @@ func TestCollectorOptionsWithFlags_CheckFullHostPort(t *testing.T) {
56
56
57
57
func TestCollectorOptionsWithFlags_CheckExpvarOptions (t * testing.T ) {
58
58
c := & CollectorOptions {}
59
- v , command := config .Viperize (AddFlags )
60
- command .ParseFlags ([]string {
61
- "--collector.num-workers=42" ,
62
- "--collector.queue-size=24" ,
63
- })
59
+ v , _ := config .Viperize (AddFlags )
64
60
c .InitFromViper (v )
65
61
66
62
gotNumWorkers , err := strconv .Atoi (expvar .Get ("collector.num-workers" ).String ())
@@ -69,6 +65,6 @@ func TestCollectorOptionsWithFlags_CheckExpvarOptions(t *testing.T) {
69
65
gotQueueSize , err := strconv .Atoi (expvar .Get ("collector.queue-size" ).String ())
70
66
assert .NoError (t , err )
71
67
72
- assert .Equal (t , 42 , gotNumWorkers )
73
- assert .Equal (t , 24 , gotQueueSize )
68
+ assert .Equal (t , DefaultNumWorkers , gotNumWorkers )
69
+ assert .Equal (t , DefaultQueueSize , gotQueueSize )
74
70
}
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ func (f *Factory) Close() error {
255
255
256
256
func (f * Factory ) setExpvarOptions () {
257
257
if expvar .Get (downsamplingRatio ) == nil {
258
- expvar .NewInt (downsamplingRatio ).Set (int64 ( f .FactoryConfig .DownsamplingRatio ) )
258
+ expvar .NewFloat (downsamplingRatio ).Set (f .FactoryConfig .DownsamplingRatio )
259
259
}
260
260
if expvar .Get (spanStorageType ) == nil {
261
261
expvar .NewString (spanStorageType ).Set (f .SpanReaderType )
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"fmt"
23
23
"io"
24
24
"reflect"
25
+ "strconv"
25
26
"strings"
26
27
"testing"
27
28
@@ -362,8 +363,9 @@ func TestSetExpvarOptions(t *testing.T) {
362
363
l := zap .NewNop ()
363
364
f .Initialize (m , l )
364
365
365
- gotDownsamplingRatio := expvar .Get (downsamplingRatio )
366
366
gotSpanStorageType := expvar .Get (spanStorageType )
367
+ gotDownsamplingRatio , err := strconv .ParseFloat (expvar .Get (downsamplingRatio ).String (), 64 )
368
+ assert .NoError (t , err )
367
369
368
370
assert .Equal (t , f .DownsamplingRatio , gotDownsamplingRatio )
369
371
assert .Equal (t , f .SpanReaderType , gotSpanStorageType )
You can’t perform that action at this time.
0 commit comments