@@ -258,7 +258,8 @@ int opentelemetry_post(struct opentelemetry_context *ctx,
258258 return FLB_RETRY ;
259259 }
260260
261- if (request -> protocol_version == HTTP_PROTOCOL_VERSION_20 ) {
261+ if (request -> protocol_version == HTTP_PROTOCOL_VERSION_20 &&
262+ ctx -> enable_grpc_flag ) {
262263 grpc_body = cfl_sds_create_size (body_len + 5 );
263264
264265 if (grpc_body == NULL ) {
@@ -269,7 +270,7 @@ int opentelemetry_post(struct opentelemetry_context *ctx,
269270
270271 wire_message_length = (uint32_t ) body_len ;
271272
272- cfl_sds_cat (grpc_body , "\x00----" , 5 );
273+ sds_result = cfl_sds_cat (grpc_body , "\x00----" , 5 );
273274
274275 if (sds_result == NULL ) {
275276 flb_http_client_request_destroy (request , FLB_TRUE );
@@ -376,17 +377,24 @@ int opentelemetry_post(struct opentelemetry_context *ctx,
376377 * - 205: Reset content
377378 *
378379 */
380+
379381 if (response -> status < 200 || response -> status > 205 ) {
380382 if (ctx -> log_response_payload &&
381383 response -> body != NULL &&
382384 cfl_sds_len (response -> body ) > 0 ) {
383- flb_plg_error (ctx -> ins , "%s:%i, HTTP status=%i\n%s" ,
384- ctx -> host , ctx -> port ,
385- response -> status , response -> body );
385+ flb_plg_error (ctx -> ins ,
386+ "%s:%i, HTTP status=%i\n%s" ,
387+ ctx -> host ,
388+ ctx -> port ,
389+ response -> status ,
390+ response -> body );
386391 }
387392 else {
388- flb_plg_error (ctx -> ins , "%s:%i, HTTP status=%i" ,
389- ctx -> host , ctx -> port , response -> status );
393+ flb_plg_error (ctx -> ins ,
394+ "%s:%i, HTTP status=%i" ,
395+ ctx -> host ,
396+ ctx -> port ,
397+ response -> status );
390398 }
391399
392400 out_ret = FLB_RETRY ;
@@ -699,6 +707,11 @@ static struct flb_config_map config_map[] = {
699707 0 , FLB_TRUE , offsetof(struct opentelemetry_context , enable_http2 ),
700708 "Enable, disable or force HTTP/2 usage. Accepted values : on, off, force"
701709 },
710+ {
711+ FLB_CONFIG_MAP_BOOL , "grpc" , "off" ,
712+ 0 , FLB_TRUE , offsetof(struct opentelemetry_context , enable_grpc_flag ),
713+ "Enable, disable or force gRPC usage. Accepted values : on, off, auto"
714+ },
702715 {
703716 FLB_CONFIG_MAP_STR , "proxy" , NULL ,
704717 0 , FLB_FALSE , 0 ,
0 commit comments