Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debug log of OTLP HTTP exporter and ES log exporter #1703

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions exporters/elasticsearch/src/es_log_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class ResponseHandler : public http_client::EventHandler
const std::string &body) noexcept
{
std::stringstream ss;
ss << "Status:" << response.GetStatusCode() << "Header:";
ss << "Status:" << response.GetStatusCode() << ", Header:";
response.ForEachHeader([&ss](opentelemetry::nostd::string_view header_name,
opentelemetry::nostd::string_view header_value) {
ss << "\t" << header_name.data() << " : " << header_value.data() << ",";
ss << "\t" << header_name.data() << ": " << header_value.data() << ",";
return true;
});
ss << "Body:" << body;
Expand Down
7 changes: 3 additions & 4 deletions exporters/otlp/src/otlp_http_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class ResponseHandler : public http_client::EventHandler
const std::string &body) noexcept
{
std::stringstream ss;
ss << "Status:" << response.GetStatusCode() << "Header:";
ss << "Status:" << response.GetStatusCode() << ", Header:";
response.ForEachHeader([&ss](opentelemetry::nostd::string_view header_name,
opentelemetry::nostd::string_view header_value) {
ss << "\t" << header_name.data() << " : " << header_value.data() << ",";
ss << "\t" << header_name.data() << ": " << header_value.data() << ",";
return true;
});
ss << "Body:" << body;
Expand Down Expand Up @@ -116,8 +116,7 @@ class ResponseHandler : public http_client::EventHandler
OTEL_INTERNAL_LOG_ERROR("OTLP HTTP Client] Export failed, " << log_message);
result = sdk::common::ExportResult::kFailure;
}

if (console_debug_)
else if (console_debug_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the if (log_message.empty()) below can be simplified, it should be always true.

{
if (log_message.empty())
{
Expand Down