@@ -493,14 +493,16 @@ TEST_F(MetricsTest, PrometheusDuplicateTypeFix) {
493493 // 1. Create the first entity and register a metric with a group name
494494 auto entity1 = registry.register_entity (" entity1" );
495495 // Using MetricPrototype is the "official way" in Doris metrics_test
496- MetricPrototype requests_type (MetricType::COUNTER, MetricUnit::OPERATIONS, " requests_total" , " " , " engine_requests" );
496+ MetricPrototype requests_type (MetricType::COUNTER, MetricUnit::OPERATIONS, " requests_total" ,
497+ " " , " engine_requests" );
497498 IntCounter* m1 = (IntCounter*)entity1->register_metric <IntCounter>(&requests_type);
498499 m1->increment (1 );
499500
500501 // 2. Create the second entity and register a metric with a DIFFERENT name to break continuity
501502 auto entity2 = registry.register_entity (" entity2" );
502- MetricPrototype other_type (MetricType::COUNTER, MetricUnit::OPERATIONS, " other_metric" , " " , " " );
503- IntCounter* m2 = (IntCounter*)entity2->register_metric <IntCounter>(&other_type); // 修复:使用 register_metric
503+ MetricPrototype other_type (MetricType::COUNTER, MetricUnit::OPERATIONS, " other_metric" , " " ,
504+ " " );
505+ IntCounter* m2 = (IntCounter*)entity2->register_metric <IntCounter>(&other_type);
504506 m2->increment (5 );
505507
506508 // 3. Create the third entity and register the SAME group name metric again
@@ -515,9 +517,9 @@ TEST_F(MetricsTest, PrometheusDuplicateTypeFix) {
515517 // Verification: Count the occurrences of "# TYPE test_registry_engine_requests counter"
516518 // In your official snippet, the format is: # TYPE {registry_name}_{group_name} {type}
517519 std::string target_type_line = " # TYPE test_registry_engine_requests counter" ;
518-
520+
519521 int occurrences = 0 ;
520- size_t pos = 0 ; // 修复:使用 size_t 而不是 std::string::size_t
522+ size_t pos = 0 ;
521523 while ((pos = output.find (target_type_line, pos)) != std::string::npos) {
522524 occurrences++;
523525 pos += target_type_line.length ();
@@ -533,4 +535,3 @@ TEST_F(MetricsTest, PrometheusDuplicateTypeFix) {
533535 }
534536}
535537} // namespace doris
536-
0 commit comments