@@ -104,40 +104,58 @@ func TestClientMetricsReporter_Jaeger(t *testing.T) {
104
104
clientUUID : & clientUUID ,
105
105
seqNo : nPtr (100 ),
106
106
expLog : clientUUID ,
107
- runExpire : true ,
107
+ stats : & jaeger.ClientStats {
108
+ FullQueueDroppedSpans : 10 ,
109
+ TooLargeDroppedSpans : 10 ,
110
+ FailedToEmitSpans : 10 ,
111
+ },
112
+ runExpire : true ,
113
+ // first batch cannot increment counters, only capture the baseline
108
114
expCounters : []metricstest.ExpectedMetric {
109
- {Name : prefix + "batches_sent" , Value : 100 },
115
+ {Name : prefix + "batches_sent" , Value : 0 },
116
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "full-queue" ), Value : 0 },
117
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "too-large" ), Value : 0 },
118
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "send-failure" ), Value : 0 },
110
119
},
111
120
expGauges : []metricstest.ExpectedMetric {
112
121
{Name : prefix + "connected_clients" , Value : 1 },
113
122
},
114
123
},
115
124
{
116
125
clientUUID : & clientUUID ,
117
- seqNo : nPtr (101 ),
126
+ seqNo : nPtr (105 ),
127
+ stats : & jaeger.ClientStats {
128
+ FullQueueDroppedSpans : 15 ,
129
+ TooLargeDroppedSpans : 15 ,
130
+ FailedToEmitSpans : 15 ,
131
+ },
118
132
expCounters : []metricstest.ExpectedMetric {
119
- {Name : prefix + "batches_sent" , Value : 101 },
133
+ {Name : prefix + "batches_sent" , Value : 5 },
134
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "full-queue" ), Value : 5 },
135
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "too-large" ), Value : 5 },
136
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "send-failure" ), Value : 5 },
120
137
},
121
138
},
122
139
{
123
140
clientUUID : & clientUUID ,
124
141
seqNo : nPtr (90 ), // out of order batch will be ignored
125
142
expCounters : []metricstest.ExpectedMetric {
126
- {Name : prefix + "batches_sent" , Value : 101 }, // unchanged!
143
+ {Name : prefix + "batches_sent" , Value : 5 }, // unchanged!
127
144
},
128
145
},
129
146
{
130
147
clientUUID : & clientUUID ,
131
148
seqNo : nPtr (110 ),
149
+ // use different stats values to test the correct assignments
132
150
stats : & jaeger.ClientStats {
133
- FullQueueDroppedSpans : 5 ,
134
- TooLargeDroppedSpans : 6 ,
135
- FailedToEmitSpans : 7 ,
151
+ FullQueueDroppedSpans : 17 ,
152
+ TooLargeDroppedSpans : 18 ,
153
+ FailedToEmitSpans : 19 ,
136
154
}, expCounters : []metricstest.ExpectedMetric {
137
- {Name : prefix + "batches_sent" , Value : 110 },
138
- {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "full-queue" ), Value : 5 },
139
- {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "too-large" ), Value : 6 },
140
- {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "send-failure" ), Value : 7 },
155
+ {Name : prefix + "batches_sent" , Value : 10 },
156
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "full-queue" ), Value : 7 },
157
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "too-large" ), Value : 8 },
158
+ {Name : prefix + "spans_dropped" , Tags : tag ("cause" , "send-failure" ), Value : 9 },
141
159
},
142
160
},
143
161
}
@@ -219,8 +237,6 @@ func TestClientMetricsReporter_Expire(t *testing.T) {
219
237
err := tr .r .EmitBatch (batch )
220
238
assert .NoError (t , err )
221
239
assert .Len (t , tr .mr .Spans (), 1 )
222
- tr .mb .AssertCounterMetrics (t ,
223
- metricstest.ExpectedMetric {Name : "client_stats.batches_sent" , Value : 1 })
224
240
225
241
// here we test that a connected-client gauge is updated to 1 by the auto-scheduled expire loop,
226
242
// and then reset to 0 once the client entry expires.
0 commit comments