@@ -199,6 +199,8 @@ void flb_test_log_to_metrics_counter_k8s(void)
199199 const char * expected = "\"value\":5.0,\"labels\":[\"k8s-dummy\","
200200 "\"testpod\",\"mycontainer\",\"abc123\","
201201 "\"def456\",\"red\",\"right\"]" ;
202+ const char * expected2 = "{\"ns\":\"log_metric\",\"ss\":\"counter\","
203+ "\"name\":\"test\",\"desc\":\"Counts messages\"}" ;
202204
203205 ctx = flb_create ();
204206 flb_service_set (ctx , "Flush" , "0.200000000" , "Grace" , "1" , "Log_Level" ,
@@ -219,6 +221,7 @@ void flb_test_log_to_metrics_counter_k8s(void)
219221 "metric_mode" , "counter" ,
220222 "metric_name" , "test" ,
221223 "metric_description" , "Counts messages" ,
224+ "metric_subsystem" , "" ,
222225 "kubernetes_mode" , "on" ,
223226 "label_field" , "color" ,
224227 "label_field" , "direction" ,
@@ -242,6 +245,10 @@ void flb_test_log_to_metrics_counter_k8s(void)
242245 if (!TEST_CHECK (result != NULL )) {
243246 TEST_MSG ("expected substring:\n%s\ngot:\n%s\n" , expected , finalString );
244247 }
248+ result = strstr (finalString , expected2 );
249+ if (!TEST_CHECK (result != NULL )) {
250+ TEST_MSG ("expected substring:\n%s\ngot:\n%s\n" , expected , finalString );
251+ }
245252
246253 filter_test_destroy (ctx );
247254
@@ -260,6 +267,8 @@ void flb_test_log_to_metrics_counter(void)
260267 char * input = JSON_MSG1 ;
261268 char finalString [32768 ] = "" ;
262269 const char * expected = "\"value\":5.0,\"labels\":[\"red\",\"right\"]" ;
270+ const char * expected2 = "{\"ns\":\"myns\",\"ss\":\"subsystem\","
271+ "\"name\":\"test\",\"desc\":\"Counts messages\"}" ;
263272
264273 ctx = flb_create ();
265274 flb_service_set (ctx , "Flush" , "0.200000000" , "Grace" , "1" , "Log_Level" ,
@@ -280,6 +289,8 @@ void flb_test_log_to_metrics_counter(void)
280289 "metric_mode" , "counter" ,
281290 "metric_name" , "test" ,
282291 "metric_description" , "Counts messages" ,
292+ "metric_subsystem" , "subsystem" ,
293+ "metric_namespace" , "myns" ,
283294 "kubernetes_mode" , "off" ,
284295 "label_field" , "color" ,
285296 "label_field" , "direction" ,
@@ -302,6 +313,10 @@ void flb_test_log_to_metrics_counter(void)
302313 if (!TEST_CHECK (result != NULL )) {
303314 TEST_MSG ("expected substring:\n%s\ngot:\n%s\n" , expected , finalString );
304315 }
316+ result = strstr (finalString , expected2 );
317+ if (!TEST_CHECK (result != NULL )) {
318+ TEST_MSG ("expected substring:\n%s\ngot:\n%s\n" , expected , finalString );
319+ }
305320 filter_test_destroy (ctx );
306321
307322}
@@ -346,6 +361,7 @@ void flb_test_log_to_metrics_counter_k8s_two_tuples(void)
346361 "metric_mode" , "counter" ,
347362 "metric_name" , "test" ,
348363 "metric_description" , "Counts two different messages" ,
364+ "metric_subsystem" , "" ,
349365 "kubernetes_mode" , "on" ,
350366 "label_field" , "color" ,
351367 "label_field" , "direction" ,
@@ -414,6 +430,7 @@ void flb_test_log_to_metrics_gauge(void)
414430 "metric_mode" , "gauge" ,
415431 "metric_name" , "test" ,
416432 "metric_description" , "Reports gauge from messages" ,
433+ "metric_subsystem" , "" ,
417434 "kubernetes_mode" , "off" ,
418435 "value_field" , "duration" ,
419436 "label_field" , "color" ,
@@ -478,6 +495,7 @@ void flb_test_log_to_metrics_histogram(void)
478495 "metric_mode" , "histogram" ,
479496 "metric_name" , "test" ,
480497 "metric_description" , "Histogram of duration" ,
498+ "metric_subsystem" , "" ,
481499 "kubernetes_mode" , "off" ,
482500 "value_field" , "duration" ,
483501 "label_field" , "color" ,
@@ -542,6 +560,7 @@ void flb_test_log_to_metrics_reg(void)
542560 "metric_mode" , "counter" ,
543561 "metric_name" , "test" ,
544562 "metric_description" , "Counts messages with regex" ,
563+ "metric_subsystem" , "" ,
545564 "kubernetes_mode" , "off" ,
546565 "label_field" , "color" ,
547566 "label_field" , "direction" ,
@@ -607,6 +626,7 @@ void flb_test_log_to_metrics_empty_label_keys_regex(void)
607626 "metric_mode" , "counter" ,
608627 "metric_name" , "test" ,
609628 "metric_description" , "Counts messages with regex" ,
629+ "metric_subsystem" , "" ,
610630 "kubernetes_mode" , "off" ,
611631 "regex" , "message .*el.*" ,
612632 NULL );
@@ -668,6 +688,7 @@ void flb_test_log_to_metrics_label(void)
668688 "metric_mode" , "counter" ,
669689 "metric_name" , "test" ,
670690 "metric_description" , "Counts messages" ,
691+ "metric_subsystem" , "" ,
671692 "kubernetes_mode" , "off" ,
672693 "add_label" , "pod_name $kubernetes['pod_name']" ,
673694 NULL );
0 commit comments