@@ -50,17 +50,25 @@ static inline struct cfl_variant *get_body_variant(struct flb_mp_chunk_record *r
5050}
5151
5252static struct cfl_variant * get_otel_container_variant (struct flb_mp_chunk_record * record ,
53- const char * key )
53+ const char * key ,
54+ int use_group_attributes )
5455{
55- struct cfl_variant * body ;
56+ struct cfl_variant * source ;
5657 struct cfl_variant * container ;
5758
58- body = get_body_variant (record );
59- if (!body || body -> type != CFL_VARIANT_KVLIST ) {
59+ /* For OTLP, resource/scope attributes are in group_attributes, not body */
60+ if (use_group_attributes && record -> cobj_group_attributes && record -> cobj_group_attributes -> variant ) {
61+ source = record -> cobj_group_attributes -> variant ;
62+ }
63+ else {
64+ source = get_body_variant (record );
65+ }
66+
67+ if (!source || source -> type != CFL_VARIANT_KVLIST ) {
6068 return NULL ;
6169 }
6270
63- container = cfl_kvlist_fetch (body -> data .as_kvlist , key );
71+ container = cfl_kvlist_fetch (source -> data .as_kvlist , key );
6472 if (!container || container -> type != CFL_VARIANT_KVLIST ) {
6573 return NULL ;
6674 }
@@ -84,7 +92,8 @@ static struct cfl_variant *get_otel_attributes_variant(struct flb_mp_chunk_recor
8492 return NULL ;
8593 }
8694
87- container = get_otel_container_variant (record , container_key );
95+ /* For OTLP resource/scope attributes, look in group_attributes first */
96+ container = get_otel_container_variant (record , container_key , 1 );
8897 if (!container ) {
8998 return NULL ;
9099 }
@@ -101,7 +110,8 @@ static struct cfl_variant *get_otel_scope_metadata_variant(struct flb_mp_chunk_r
101110{
102111 struct cfl_variant * scope ;
103112
104- scope = get_otel_container_variant (record , "scope" );
113+ /* For OTLP scope metadata, also check group_attributes first */
114+ scope = get_otel_container_variant (record , "scope" , 1 );
105115 if (!scope || scope -> type != CFL_VARIANT_KVLIST ) {
106116 return NULL ;
107117 }
@@ -400,6 +410,31 @@ struct flb_condition *flb_router_route_get_condition(struct flb_route *route)
400410 return route_condition_get_compiled (route -> condition );
401411}
402412
413+ int flb_router_condition_evaluate_record (struct flb_route * route ,
414+ struct flb_mp_chunk_record * record )
415+ {
416+ struct flb_condition * compiled ;
417+
418+ if (!route || !record ) {
419+ return FLB_FALSE ;
420+ }
421+
422+ if (!route -> condition ) {
423+ return FLB_TRUE ;
424+ }
425+
426+ compiled = flb_router_route_get_condition (route );
427+ if (!compiled ) {
428+ if (route -> condition -> is_default ) {
429+ return FLB_TRUE ;
430+ }
431+
432+ return FLB_FALSE ;
433+ }
434+
435+ return flb_condition_evaluate_ex (compiled , record , route_logs_get_variant );
436+ }
437+
403438static int parse_rule_operator (const flb_sds_t op_str ,
404439 enum flb_rule_operator * out )
405440{
0 commit comments