From 994761988eed36a41014de6291d470c738190ae0 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Thu, 24 Oct 2024 14:32:48 +0200 Subject: [PATCH] [EXPORTER] Add logging for async gRPC errors (#3108) --- exporters/otlp/src/otlp_grpc_client.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/exporters/otlp/src/otlp_grpc_client.cc b/exporters/otlp/src/otlp_grpc_client.cc index d3d59bce6e..44d86004a9 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; @@ -216,6 +216,13 @@ static sdk::common::ExportResult InternalDelegateAsyncExport( { 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) {