@@ -48,32 +48,32 @@ func BenchmarkMetricLine(b *testing.B) {
4848
4949 var r string
5050 for n := 0 ; n < b .N ; n ++ {
51- r , _ = MetricLine (name , value , ts , src , tags , "" )
51+ r , _ = metricLine (name , value , ts , src , tags , "" )
5252 }
5353 line = r
5454}
5555
5656func TestMetricLine (t * testing.T ) {
57- line , err := MetricLine ("foo.metric" , 1.2 , 1533529977 , "test_source" ,
57+ line , err := metricLine ("foo.metric" , 1.2 , 1533529977 , "test_source" ,
5858 map [string ]string {"env" : "test" }, "" )
5959 expected := "\" foo.metric\" 1.2 1533529977 source=\" test_source\" \" env\" =\" test\" \n "
6060 assert .Nil (t , err )
6161 assert .Equal (t , expected , line )
6262
63- line , err = MetricLine ("foo.metric" , 1.2 , 1533529977 , "" ,
63+ line , err = metricLine ("foo.metric" , 1.2 , 1533529977 , "" ,
6464 map [string ]string {"env" : "test" }, "default" )
6565 expected = "\" foo.metric\" 1.2 1533529977 source=\" default\" \" env\" =\" test\" \n "
6666 assert .Nil (t , err )
6767 assert .Equal (t , expected , line )
6868
69- line , err = MetricLine ("foo.metric" , 1.2 , 1533529977 , "1.2.3.4:8080" ,
69+ line , err = metricLine ("foo.metric" , 1.2 , 1533529977 , "1.2.3.4:8080" ,
7070 map [string ]string {"env" : "test" }, "default" )
7171 expected = "\" foo.metric\" 1.2 1533529977 source=\" 1.2.3.4:8080\" \" env\" =\" test\" \n "
7272 assert .Nil (t , err )
7373 assert .Equal (t , expected , line )
7474}
7575
76- func BenchmarkHistoLine (b * testing.B ) {
76+ func BenchmarkHistogramLine (b * testing.B ) {
7777 name := "request.latency"
7878 centroids := makeCentroids ()
7979 hgs := map [histogram.Granularity ]bool {histogram .MINUTE : true }
@@ -83,12 +83,12 @@ func BenchmarkHistoLine(b *testing.B) {
8383
8484 var r string
8585 for n := 0 ; n < b .N ; n ++ {
86- r , _ = HistoLine (name , centroids , hgs , ts , src , tags , "" )
86+ r , _ = histogramLine (name , centroids , hgs , ts , src , tags , "" )
8787 }
8888 line = r
8989}
9090
91- func TestHistoLineCentroidsFormat (t * testing.T ) {
91+ func TestHistogramLineCentroidsFormat (t * testing.T ) {
9292 centroids := histogram.Centroids {
9393 {Value : 30.0 , Count : 20 },
9494 {Value : 5.1 , Count : 10 },
@@ -97,7 +97,7 @@ func TestHistoLineCentroidsFormat(t *testing.T) {
9797 {Value : 30.0 , Count : 20 },
9898 }
9999
100- line , err := HistoLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true },
100+ line , err := histogramLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true },
101101 1533529977 , "test_source" , map [string ]string {"env" : "test" }, "" )
102102
103103 assert .Nil (t , err )
@@ -117,34 +117,34 @@ func TestHistoLineCentroidsFormat(t *testing.T) {
117117 }
118118}
119119
120- func TestHistoLine (t * testing.T ) {
120+ func TestHistogramLine (t * testing.T ) {
121121 centroids := makeCentroids ()
122122
123- line , err := HistoLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true },
123+ line , err := histogramLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true },
124124 1533529977 , "test_source" , map [string ]string {"env" : "test" }, "" )
125125 expected := "!M 1533529977 #20 30 \" request.latency\" source=\" test_source\" \" env\" =\" test\" \n "
126126 assert .Nil (t , err )
127127 assert .Equal (t , expected , line )
128128
129- line , err = HistoLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true , histogram .HOUR : false },
129+ line , err = histogramLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true , histogram .HOUR : false },
130130 1533529977 , "" , map [string ]string {"env" : "test" }, "default" )
131131 expected = "!M 1533529977 #20 30 \" request.latency\" source=\" default\" \" env\" =\" test\" \n "
132132 assert .Nil (t , err )
133133 assert .Equal (t , expected , line )
134134
135- line , err = HistoLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .HOUR : true , histogram .MINUTE : false },
135+ line , err = histogramLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .HOUR : true , histogram .MINUTE : false },
136136 1533529977 , "" , map [string ]string {"env" : "test" }, "default" )
137137 expected = "!H 1533529977 #20 30 \" request.latency\" source=\" default\" \" env\" =\" test\" \n "
138138 assert .Nil (t , err )
139139 assert .Equal (t , expected , line )
140140
141- line , err = HistoLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .DAY : true },
141+ line , err = histogramLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .DAY : true },
142142 1533529977 , "" , map [string ]string {"env" : "test" }, "default" )
143143 expected = "!D 1533529977 #20 30 \" request.latency\" source=\" default\" \" env\" =\" test\" \n "
144144 assert .Nil (t , err )
145145 assert .Equal (t , expected , line )
146146
147- line , err = HistoLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true , histogram .HOUR : true , histogram .DAY : false },
147+ line , err = histogramLine ("request.latency" , centroids , map [histogram.Granularity ]bool {histogram .MINUTE : true , histogram .HOUR : true , histogram .DAY : false },
148148 1533529977 , "test_source" , map [string ]string {"env" : "test" }, "" )
149149 expected = "!M 1533529977 #20 30 \" request.latency\" source=\" test_source\" \" env\" =\" test\" \n " +
150150 "!H 1533529977 #20 30 \" request.latency\" source=\" test_source\" \" env\" =\" test\" \n "
@@ -162,29 +162,29 @@ func BenchmarkSpanLine(b *testing.B) {
162162
163163 var r string
164164 for n := 0 ; n < b .N ; n ++ {
165- r , _ = SpanLine (name , start , dur , src , traceId , traceId , []string {traceId }, nil , nil , nil , "" )
165+ r , _ = spanLine (name , start , dur , src , traceId , traceId , []string {traceId }, nil , nil , nil , "" )
166166 }
167167 line = r
168168}
169169
170170func TestSpanLine (t * testing.T ) {
171- line , err := SpanLine ("order.shirts" , 1533531013 , 343500 , "test_source" ,
171+ line , err := spanLine ("order.shirts" , 1533531013 , 343500 , "test_source" ,
172172 "7b3bf470-9456-11e8-9eb6-529269fb1459" , "7b3bf470-9456-11e8-9eb6-529269fb1459" ,
173173 []string {"7b3bf470-9456-11e8-9eb6-529269fb1458" }, nil , nil , nil , "" )
174174 expected := "\" order.shirts\" source=\" test_source\" traceId=7b3bf470-9456-11e8-9eb6-529269fb1459" +
175175 " spanId=7b3bf470-9456-11e8-9eb6-529269fb1459 parent=7b3bf470-9456-11e8-9eb6-529269fb1458 1533531013 343500\n "
176176 assert .Nil (t , err )
177177 assert .Equal (t , expected , line )
178178
179- line , err = SpanLine ("order.shirts" , 1533531013 , 343500 , "test_source" ,
179+ line , err = spanLine ("order.shirts" , 1533531013 , 343500 , "test_source" ,
180180 "7b3bf470-9456-11e8-9eb6-529269fb1459" , "7b3bf470-9456-11e8-9eb6-529269fb1459" , nil ,
181181 []string {"7b3bf470-9456-11e8-9eb6-529269fb1458" }, []SpanTag {{Key : "env" , Value : "test" }}, nil , "" )
182182 expected = "\" order.shirts\" source=\" test_source\" traceId=7b3bf470-9456-11e8-9eb6-529269fb1459" +
183183 " spanId=7b3bf470-9456-11e8-9eb6-529269fb1459 followsFrom=7b3bf470-9456-11e8-9eb6-529269fb1458 \" env\" =\" test\" 1533531013 343500\n "
184184 assert .Nil (t , err )
185185 assert .Equal (t , expected , line )
186186
187- line , err = SpanLine ("order.shirts" , 1533531013 , 343500 , "test_source" ,
187+ line , err = spanLine ("order.shirts" , 1533531013 , 343500 , "test_source" ,
188188 "7b3bf470-9456-11e8-9eb6-529269fb1459" , "7b3bf470-9456-11e8-9eb6-529269fb1459" , nil ,
189189 []string {"7b3bf470-9456-11e8-9eb6-529269fb1458" },
190190 []SpanTag {{Key : "env" , Value : "test" }, {Key : "env" , Value : "dev" }}, nil , "" )
@@ -197,24 +197,24 @@ func TestSpanLine(t *testing.T) {
197197func TestSpanLineErrors (t * testing.T ) {
198198 uuid := "00000000-0000-0000-0000-000000000000"
199199
200- _ , err := SpanLine ("" , 0 , 0 , "" , uuid , uuid , nil , nil , nil , nil , "" )
200+ _ , err := spanLine ("" , 0 , 0 , "" , uuid , uuid , nil , nil , nil , nil , "" )
201201 require .Error (t , err )
202202 assert .Equal (t , "span name cannot be empty" , err .Error ())
203203
204- _ , err = SpanLine ("a_name" , 0 , 0 , "00-00" , "x" , uuid , nil , nil , nil , nil , "" )
204+ _ , err = spanLine ("a_name" , 0 , 0 , "00-00" , "x" , uuid , nil , nil , nil , nil , "" )
205205 require .Error (t , err )
206206 assert .Equal (t , "traceId is not in UUID format: span=a_name traceId=x" , err .Error ())
207207
208- _ , err = SpanLine ("a_name" , 0 , 0 , "00-00" , uuid , "x" , nil , nil , nil , nil , "" )
208+ _ , err = spanLine ("a_name" , 0 , 0 , "00-00" , uuid , "x" , nil , nil , nil , nil , "" )
209209 require .Error (t , err )
210210 assert .Equal (t , "spanId is not in UUID format: span=a_name spanId=x" , err .Error ())
211211
212- _ , err = SpanLine ("a_name" , 0 , 0 , "a_source" , uuid , uuid , nil , nil ,
212+ _ , err = spanLine ("a_name" , 0 , 0 , "a_source" , uuid , uuid , nil , nil ,
213213 []SpanTag {{Key : "" , Value : "" }}, nil , "" )
214214 require .Error (t , err )
215215 assert .Equal (t , "tag keys cannot be empty: span=a_name" , err .Error ())
216216
217- _ , err = SpanLine ("a_name" , 0 , 0 , "a_source" , uuid , uuid , nil , nil ,
217+ _ , err = spanLine ("a_name" , 0 , 0 , "a_source" , uuid , uuid , nil , nil ,
218218 []SpanTag {{Key : "a_tag" , Value : "" }}, nil , "" )
219219 require .Error (t , err )
220220 assert .Equal (t , "tag values cannot be empty: span=a_name tag=a_tag" , err .Error ())
0 commit comments