Add metadata type for W3C traceparent header

PiperOrigin-RevId: 696316643
pull/38089/head
Yash Tibrewal 2 weeks ago committed by Copybara-Service
parent 5c0906016b
commit 06b2452feb
  1. 1
      src/core/lib/transport/metadata_batch.cc
  2. 10
      src/core/lib/transport/metadata_batch.h

@ -83,6 +83,7 @@ bool DebugStringBuilder::IsAllowListed(const absl::string_view key) const {
allow_list.insert(std::string(LbTokenMetadata::key()));
allow_list.insert(std::string(TeMetadata::key()));
allow_list.insert(std::string(UserAgentMetadata::key()));
allow_list.insert(std::string(W3CTraceParentMetadata::key()));
allow_list.insert(std::string(XEnvoyPeerMetadata::key()));
// go/keep-sorted end
// go/keep-sorted start

@ -468,6 +468,14 @@ struct LbCostBinMetadata {
MetadataParseErrorFn on_error);
};
// traceparent metadata
struct W3CTraceParentMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static constexpr bool kTransferOnTrailersOnly = false;
using CompressionTraits = FrequentKeyWithNoValueCompressionCompressor;
static absl::string_view key() { return "traceparent"; }
};
// Annotation added by a transport to note whether a failed request was never
// placed on the wire, or never seen by a server.
struct GrpcStreamNetworkState {
@ -1582,7 +1590,7 @@ using grpc_metadata_batch_base = grpc_core::MetadataMap<
grpc_core::GrpcServerStatsBinMetadata, grpc_core::GrpcTraceBinMetadata,
grpc_core::GrpcTagsBinMetadata, grpc_core::GrpcLbClientStatsMetadata,
grpc_core::LbCostBinMetadata, grpc_core::LbTokenMetadata,
grpc_core::XEnvoyPeerMetadata,
grpc_core::XEnvoyPeerMetadata, grpc_core::W3CTraceParentMetadata,
// Non-encodable things
grpc_core::GrpcStreamNetworkState, grpc_core::PeerString,
grpc_core::GrpcStatusContext, grpc_core::GrpcStatusFromWire,

Loading…
Cancel
Save