From 23810319eadc2b88484ff229fa25be8b42428d69 Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Fri, 10 Jan 2025 10:34:27 +0100 Subject: [PATCH] out_opentelemetry: show grpc response status and msg Signed-off-by: Florian Bezannier --- plugins/out_opentelemetry/opentelemetry.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/out_opentelemetry/opentelemetry.c b/plugins/out_opentelemetry/opentelemetry.c index 98a09eadadc..4db2752a5e2 100644 --- a/plugins/out_opentelemetry/opentelemetry.c +++ b/plugins/out_opentelemetry/opentelemetry.c @@ -437,6 +437,21 @@ int opentelemetry_post(struct opentelemetry_context *ctx, } else { if (ctx->log_response_payload && + strncasecmp(response->content_type, "application/grpc", 16) + == 0){ + grpc_status = flb_hash_table_get_ptr(response->headers, + "grpc-status", 11); + grpc_message = flb_hash_table_get_ptr(response->headers, + "grpc-message", 12); + flb_plg_info(ctx->ins, + "%s:%i, HTTP status=%i GRPC status=%s \n%s", + ctx->host, + ctx->port, + response->status, + grpc_status, + grpc_message); + } + else if (ctx->log_response_payload && response->body != NULL && cfl_sds_len(response->body) > 0) { flb_plg_info(ctx->ins, "%s:%i, HTTP status=%i\n%s",