File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed
Expand file tree Collapse file tree 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) {
5656
5757func TestCollectorOptionsWithFlags_CheckExpvarOptions (t * testing.T ) {
5858 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 )
6460 c .InitFromViper (v )
6561
6662 gotNumWorkers , err := strconv .Atoi (expvar .Get ("collector.num-workers" ).String ())
@@ -69,6 +65,6 @@ func TestCollectorOptionsWithFlags_CheckExpvarOptions(t *testing.T) {
6965 gotQueueSize , err := strconv .Atoi (expvar .Get ("collector.queue-size" ).String ())
7066 assert .NoError (t , err )
7167
72- assert .Equal (t , 42 , gotNumWorkers )
73- assert .Equal (t , 24 , gotQueueSize )
68+ assert .Equal (t , DefaultNumWorkers , gotNumWorkers )
69+ assert .Equal (t , DefaultQueueSize , gotQueueSize )
7470}
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ func (f *Factory) Close() error {
255255
256256func (f * Factory ) setExpvarOptions () {
257257 if expvar .Get (downsamplingRatio ) == nil {
258- expvar .NewInt (downsamplingRatio ).Set (int64 ( f .FactoryConfig .DownsamplingRatio ) )
258+ expvar .NewFloat (downsamplingRatio ).Set (f .FactoryConfig .DownsamplingRatio )
259259 }
260260 if expvar .Get (spanStorageType ) == nil {
261261 expvar .NewString (spanStorageType ).Set (f .SpanReaderType )
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
2222 "fmt"
2323 "io"
2424 "reflect"
25+ "strconv"
2526 "strings"
2627 "testing"
2728
@@ -362,8 +363,9 @@ func TestSetExpvarOptions(t *testing.T) {
362363 l := zap .NewNop ()
363364 f .Initialize (m , l )
364365
365- gotDownsamplingRatio := expvar .Get (downsamplingRatio )
366366 gotSpanStorageType := expvar .Get (spanStorageType )
367+ gotDownsamplingRatio , err := strconv .ParseFloat (expvar .Get (downsamplingRatio ).String (), 64 )
368+ assert .NoError (t , err )
367369
368370 assert .Equal (t , f .DownsamplingRatio , gotDownsamplingRatio )
369371 assert .Equal (t , f .SpanReaderType , gotSpanStorageType )
You can’t perform that action at this time.
0 commit comments