Revert "[logging] Handle trailers-only responses (#33461)" (#33485)

This reverts commit cb9fe64fa5.

This broke tests
https://fusion2.corp.google.com/ci/kokoro/prod:grpc-gcp%2Ftools%2Fobservability%2Fmaster%2Fcontinuous_cpp/activity/8c408662-43bd-4377-a6b9-9a89490cea83/tests

Attempting to add a test in https://github.com/grpc/grpc/pull/33486


<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
pull/33492/head
Yash Tibrewal 2 years ago committed by GitHub
parent 55e20c3494
commit e35cf362a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      src/core/ext/filters/logging/logging_filter.cc
  2. 1
      src/core/ext/filters/logging/logging_sink.h

@ -256,19 +256,21 @@ class CallData {
void LogServerHeader(bool is_client, CallTracerAnnotationInterface* tracer,
const ServerMetadata* metadata) {
LoggingSink::Entry entry;
if (is_client) {
if (auto* value = metadata->get_pointer(PeerString())) {
peer_ = PeerStringToAddress(*value);
if (metadata != nullptr) {
if (is_client) {
if (auto* value = metadata->get_pointer(PeerString())) {
peer_ = PeerStringToAddress(*value);
}
}
}
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerHeader);
if (metadata->TransportSize() == 0) return;
seen_server_header_ = true;
MetadataEncoder encoder(&entry.payload, nullptr,
config_.max_metadata_bytes());
metadata->Encode(&encoder);
entry.payload_truncated = encoder.truncated();
if (metadata != nullptr) {
MetadataEncoder encoder(&entry.payload, nullptr,
config_.max_metadata_bytes());
metadata->Encode(&encoder);
entry.payload_truncated = encoder.truncated();
}
g_logging_sink->LogEntry(std::move(entry));
}
@ -277,7 +279,6 @@ class CallData {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerTrailer);
entry.is_trailer_only = !seen_server_header_;
if (metadata != nullptr) {
MetadataEncoder encoder(&entry.payload, &entry.payload.status_details,
config_.max_metadata_bytes());
@ -339,7 +340,6 @@ class CallData {
std::string authority_;
LoggingSink::Entry::Address peer_;
LoggingSink::Config config_;
bool seen_server_header_ = false;
};
class ClientLoggingFilter final : public ChannelFilter {

@ -107,7 +107,6 @@ class LoggingSink {
std::string trace_id;
std::string span_id;
bool is_sampled = false;
bool is_trailer_only;
};
virtual ~LoggingSink() = default;

Loading…
Cancel
Save