MCPcopy
hub / github.com/IBM/sarama / validateConsumerMetrics

Function validateConsumerMetrics

functional_producer_test.go:1235–1263  ·  view source on GitHub ↗
(t *testing.T, client Client)

Source from the content-addressed store, hash-verified

1233}
1234
1235func validateConsumerMetrics(t *testing.T, client Client) {
1236 // Get the broker used by test1 topic
1237 var broker *Broker
1238 if partitions, err := client.Partitions("test.1"); err != nil {
1239 t.Error(err)
1240 } else {
1241 for _, partition := range partitions {
1242 if b, err := client.Leader("test.1", partition); err != nil {
1243 t.Error(err)
1244 } else {
1245 if broker != nil && b != broker {
1246 t.Fatal("Expected only one broker, got at least 2")
1247 }
1248 broker = b
1249 }
1250 }
1251 }
1252
1253 metricValidators := newMetricValidators()
1254
1255 // at least 1 global fetch request for the given topic
1256 metricValidators.registerForGlobalAndTopic("test_1", minCountMeterValidator("consumer-fetch-rate", 1))
1257
1258 // and at least 1 fetch request to the lead broker
1259 metricValidators.registerForBroker(broker, minCountMeterValidator("consumer-fetch-rate", 1))
1260
1261 // Run the validators
1262 metricValidators.run(t, client.Config().MetricRegistry)
1263}
1264
1265// Benchmarks
1266

Callers 1

testProducingMessagesFunction · 0.85

Calls 10

newMetricValidatorsFunction · 0.85
minCountMeterValidatorFunction · 0.85
FatalMethod · 0.80
registerForBrokerMethod · 0.80
PartitionsMethod · 0.65
ErrorMethod · 0.65
LeaderMethod · 0.65
runMethod · 0.65
ConfigMethod · 0.65

Tested by

no test coverage detected