diff --git a/examples/grpc/tracer_common.h b/examples/grpc/tracer_common.h index c127664c90..51ffeb101f 100644 --- a/examples/grpc/tracer_common.h +++ b/examples/grpc/tracer_common.h @@ -38,7 +38,7 @@ class GrpcClientCarrier : public opentelemetry::context::propagation::TextMapCar opentelemetry::nostd::string_view value) noexcept override { std::cout << " Client ::: Adding " << key << " " << value << "\n"; - context_->AddMetadata(key.data(), value.data()); + context_->AddMetadata(std::string(key), std::string(value)); } ClientContext *context_; @@ -52,7 +52,7 @@ class GrpcServerCarrier : public opentelemetry::context::propagation::TextMapCar virtual opentelemetry::nostd::string_view Get( opentelemetry::nostd::string_view key) const noexcept override { - auto it = context_->client_metadata().find(key.data()); + auto it = context_->client_metadata().find({key.data(), key.size()}); if (it != context_->client_metadata().end()) { return it->second.data();