From d461f136047b30cc10bb1ce417539870476da3fb Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Tue, 22 Oct 2024 12:50:03 +0200 Subject: [PATCH 1/3] [EXPORTER] Add logging for async gRPC errors --- exporters/otlp/src/otlp_grpc_client.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/exporters/otlp/src/otlp_grpc_client.cc b/exporters/otlp/src/otlp_grpc_client.cc index d3d59bce6e..4b689b6075 100644 --- a/exporters/otlp/src/otlp_grpc_client.cc +++ b/exporters/otlp/src/otlp_grpc_client.cc @@ -207,7 +207,7 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( stub->experimental_async() # endif ->Export(call_data->grpc_context.get(), call_data->request, call_data->response, - [call_data, async_data](::grpc::Status grpc_status) { + [call_data, async_data, export_data_name](::grpc::Status grpc_status) { --async_data->running_requests; ++async_data->finished_request_counter; @@ -215,6 +215,11 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( if (call_data->grpc_status.ok()) { call_data->export_result = opentelemetry::sdk::common::ExportResult::kSuccess; + } else { + OTEL_INTERNAL_LOG_ERROR("[OTLP GRPC Client] ERROR: Export " + << export_data_name << " failed with status_code: \"" + << grpc_status.error_code() << "\" error_message: \"" + << grpc_status.error_message() << "\""); } if (call_data->grpc_async_callback) From 521460ba3f673455b5ff6a023ce855596a7997b8 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 24 Oct 2024 10:13:55 +0200 Subject: [PATCH 2/3] Update exporters/otlp/src/otlp_grpc_client.cc --- exporters/otlp/src/otlp_grpc_client.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exporters/otlp/src/otlp_grpc_client.cc b/exporters/otlp/src/otlp_grpc_client.cc index 4b689b6075..20ff8fb8d6 100644 --- a/exporters/otlp/src/otlp_grpc_client.cc +++ b/exporters/otlp/src/otlp_grpc_client.cc @@ -215,7 +215,9 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( if (call_data->grpc_status.ok()) { call_data->export_result = opentelemetry::sdk::common::ExportResult::kSuccess; - } else { + } + else + { OTEL_INTERNAL_LOG_ERROR("[OTLP GRPC Client] ERROR: Export " << export_data_name << " failed with status_code: \"" << grpc_status.error_code() << "\" error_message: \"" From 18d94fb124ce68e313a50c49292c4b52138f2404 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 24 Oct 2024 10:16:08 +0200 Subject: [PATCH 3/3] Update exporters/otlp/src/otlp_grpc_client.cc --- exporters/otlp/src/otlp_grpc_client.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exporters/otlp/src/otlp_grpc_client.cc b/exporters/otlp/src/otlp_grpc_client.cc index 20ff8fb8d6..44d86004a9 100644 --- a/exporters/otlp/src/otlp_grpc_client.cc +++ b/exporters/otlp/src/otlp_grpc_client.cc @@ -218,10 +218,10 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( } else { - OTEL_INTERNAL_LOG_ERROR("[OTLP GRPC Client] ERROR: Export " - << export_data_name << " failed with status_code: \"" - << grpc_status.error_code() << "\" error_message: \"" - << grpc_status.error_message() << "\""); + OTEL_INTERNAL_LOG_ERROR("[OTLP GRPC Client] ERROR: Export " + << export_data_name << " failed with status_code: \"" + << grpc_status.error_code() << "\" error_message: \"" + << grpc_status.error_message() << "\""); } if (call_data->grpc_async_callback)