@@ -105,12 +105,15 @@ static int route_payload_apply_outputs(struct flb_input_instance *ins,
105105 int direct_count ;
106106 int direct_index ;
107107 int write_ret ;
108+ int label_is_alias ;
108109 struct cfl_list * head ;
109110 struct flb_input_chunk * chunk = NULL ;
110111 struct flb_router_path * route_path ;
111112 struct flb_chunk_direct_route * direct_routes ;
112113 size_t label_length ;
114+ size_t plugin_length ;
113115 const char * label_source ;
116+ const char * plugin_name ;
114117
115118 if (!ins || !payload || !payload -> tag || !payload -> route ) {
116119 return -1 ;
@@ -210,6 +213,8 @@ static int route_payload_apply_outputs(struct flb_input_instance *ins,
210213 write_ret = 0 ;
211214 label_length = 0 ;
212215 label_source = NULL ;
216+ plugin_length = 0 ;
217+ plugin_name = NULL ;
213218
214219 cfl_list_foreach (head , & ins -> routes_direct ) {
215220 route_path = cfl_list_entry (head , struct flb_router_path , _head );
@@ -252,18 +257,39 @@ static int route_payload_apply_outputs(struct flb_input_instance *ins,
252257 if (direct_index < direct_count ) {
253258 label_source = route_path -> ins -> alias ;
254259 label_length = 0 ;
260+ plugin_name = NULL ;
261+ plugin_length = 0 ;
262+ label_is_alias = FLB_FALSE ;
255263 if (!label_source || label_source [0 ] == '\0' ) {
256264 label_source = route_path -> ins -> name ;
257265 }
266+ else {
267+ label_is_alias = FLB_TRUE ;
268+ }
258269 if (label_source ) {
259270 label_length = strlen (label_source );
260271 if (label_length > UINT16_MAX ) {
261272 label_length = UINT16_MAX ;
262273 }
263274 }
275+ if (route_path -> ins -> p && route_path -> ins -> p -> name ) {
276+ plugin_name = route_path -> ins -> p -> name ;
277+ plugin_length = strlen (plugin_name );
278+ if (plugin_length > UINT16_MAX ) {
279+ plugin_length = UINT16_MAX ;
280+ }
281+ }
282+ else {
283+ plugin_name = NULL ;
284+ plugin_length = 0 ;
285+ }
286+
264287 direct_routes [direct_index ].id = (uint32_t ) route_path -> ins -> id ;
265288 direct_routes [direct_index ].label = label_source ;
266289 direct_routes [direct_index ].label_length = (uint16_t ) label_length ;
290+ direct_routes [direct_index ].label_is_alias = (uint8_t ) label_is_alias ;
291+ direct_routes [direct_index ].plugin_name = plugin_name ;
292+ direct_routes [direct_index ].plugin_name_length = (uint16_t ) plugin_length ;
267293 direct_index ++ ;
268294 }
269295 }
0 commit comments