Skip to content

Commit b23503f

Browse files
committed
More fixes for windows
1 parent e0c0e6e commit b23503f

File tree

3 files changed

+33
-23
lines changed

3 files changed

+33
-23
lines changed

src/cpp/ext/otel/otel_client_call_tracer.cc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ OpenTelemetryPluginImpl::ClientCallTracer::CallAttemptTracer::CallAttemptTracer(
8787
/*is_client=*/true, parent_->otel_plugin_));
8888
}
8989
if (parent_->otel_plugin_->tracer_ != nullptr) {
90-
std::array<
91-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
90+
std::array<std::pair<opentelemetry::nostd::string_view,
91+
opentelemetry::common::AttributeValue>,
92+
2>
9293
attributes = {
9394
std::make_pair("previous-rpc-attempts", attempt_num),
9495
std::make_pair("transparent-retry", is_transparent_retry)};
@@ -134,8 +135,9 @@ void OpenTelemetryPluginImpl::ClientCallTracer::CallAttemptTracer::
134135
void OpenTelemetryPluginImpl::ClientCallTracer::CallAttemptTracer::
135136
RecordSendMessage(const grpc_core::SliceBuffer& send_message) {
136137
if (span_ != nullptr) {
137-
std::array<
138-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
138+
std::array<std::pair<opentelemetry::nostd::string_view,
139+
opentelemetry::common::AttributeValue>,
140+
2>
139141
attributes = {std::make_pair("sequence-number", send_seq_num_++),
140142
std::make_pair("message-size", send_message.Length())};
141143
span_->AddEvent("Outbound message", attributes);
@@ -146,8 +148,9 @@ void OpenTelemetryPluginImpl::ClientCallTracer::CallAttemptTracer::
146148
RecordSendCompressedMessage(
147149
const grpc_core::SliceBuffer& send_compressed_message) {
148150
if (span_ != nullptr) {
149-
std::array<
150-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
151+
std::array<std::pair<opentelemetry::nostd::string_view,
152+
opentelemetry::common::AttributeValue>,
153+
2>
151154
attributes = {std::make_pair("sequence-number",
152155
opentelemetry::common::AttributeValue(
153156
send_seq_num_ - 1)),
@@ -161,11 +164,12 @@ void OpenTelemetryPluginImpl::ClientCallTracer::CallAttemptTracer::
161164
void OpenTelemetryPluginImpl::ClientCallTracer::CallAttemptTracer::
162165
RecordReceivedMessage(const grpc_core::SliceBuffer& recv_message) {
163166
if (span_ != nullptr) {
164-
std::array<
165-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
167+
std::array<std::pair<opentelemetry::nostd::string_view,
168+
opentelemetry::common::AttributeValue>,
169+
2>
166170
attributes = {
167171
std::make_pair(
168-
absl::string_view("sequence-number"),
172+
"sequence-number",
169173
opentelemetry::common::AttributeValue(recv_seq_num_++)),
170174
std::make_pair(
171175
"message-size",
@@ -178,9 +182,10 @@ void OpenTelemetryPluginImpl::ClientCallTracer::CallAttemptTracer::
178182
RecordReceivedDecompressedMessage(
179183
const grpc_core::SliceBuffer& recv_decompressed_message) {
180184
if (span_ != nullptr) {
181-
std::array<
182-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
183-
attributes = {std::make_pair(absl::string_view("sequence-number"),
185+
std::array<std::pair<opentelemetry::nostd::string_view,
186+
opentelemetry::common::AttributeValue>,
187+
2>
188+
attributes = {std::make_pair("sequence-number",
184189
opentelemetry::common::AttributeValue(
185190
recv_seq_num_ - 1)),
186191
std::make_pair("message-size",

src/cpp/ext/otel/otel_server_call_tracer.cc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ void OpenTelemetryPluginImpl::ServerCallTracer::RecordReceivedInitialMetadata(
9999
void OpenTelemetryPluginImpl::ServerCallTracer::RecordReceivedMessage(
100100
const grpc_core::SliceBuffer& recv_message) {
101101
if (span_ != nullptr) {
102-
std::array<
103-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
102+
std::array<std::pair<opentelemetry::nostd::string_view,
103+
opentelemetry::common::AttributeValue>,
104+
2>
104105
attributes = {
105106
std::make_pair(
106-
absl::string_view("sequence-number"),
107+
"sequence-number",
107108
opentelemetry::common::AttributeValue(recv_seq_num_++)),
108109
std::make_pair(
109110
"message-size",
@@ -116,9 +117,10 @@ void OpenTelemetryPluginImpl::ServerCallTracer::
116117
RecordReceivedDecompressedMessage(
117118
const grpc_core::SliceBuffer& recv_decompressed_message) {
118119
if (span_ != nullptr) {
119-
std::array<
120-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
121-
attributes = {std::make_pair(absl::string_view("sequence-number"),
120+
std::array<std::pair<opentelemetry::nostd::string_view,
121+
opentelemetry::common::AttributeValue>,
122+
2>
123+
attributes = {std::make_pair("sequence-number",
122124
opentelemetry::common::AttributeValue(
123125
recv_seq_num_ - 1)),
124126
std::make_pair("message-size",
@@ -147,8 +149,9 @@ void OpenTelemetryPluginImpl::ServerCallTracer::RecordSendInitialMetadata(
147149
void OpenTelemetryPluginImpl::ServerCallTracer::RecordSendMessage(
148150
const grpc_core::SliceBuffer& send_message) {
149151
if (span_ != nullptr) {
150-
std::array<
151-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
152+
std::array<std::pair<opentelemetry::nostd::string_view,
153+
opentelemetry::common::AttributeValue>,
154+
2>
152155
attributes = {std::make_pair("sequence-number", send_seq_num_++),
153156
std::make_pair("message-size", send_message.Length())};
154157
span_->AddEvent("Outbound message", attributes);
@@ -157,8 +160,9 @@ void OpenTelemetryPluginImpl::ServerCallTracer::RecordSendMessage(
157160
void OpenTelemetryPluginImpl::ServerCallTracer::RecordSendCompressedMessage(
158161
const grpc_core::SliceBuffer& send_compressed_message) {
159162
if (span_ != nullptr) {
160-
std::array<
161-
std::pair<absl::string_view, opentelemetry::common::AttributeValue>, 2>
163+
std::array<std::pair<opentelemetry::nostd::string_view,
164+
opentelemetry::common::AttributeValue>,
165+
2>
162166
attributes = {std::make_pair("sequence-number",
163167
opentelemetry::common::AttributeValue(
164168
send_seq_num_ - 1)),

test/cpp/ext/otel/grpc_text_map_carrier_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ TEST(GrpcTextMapCarrierTest, GrpcTraceBinGet) {
5050
GrpcTextMapCarrier carrier(&md);
5151
auto arena = grpc_core::SimpleArenaAllocator()->MakeArena();
5252
grpc_core::TestContext<grpc_core::Arena> context(arena.get());
53-
std::string_view escaped_value = carrier.Get("grpc-trace-bin");
53+
absl::string_view escaped_value =
54+
NoStdStringViewToAbslStringView(carrier.Get("grpc-trace-bin"));
5455
std::string value;
5556
ASSERT_TRUE(absl::Base64Unescape(escaped_value, &value));
5657
EXPECT_EQ(value, "value");

0 commit comments

Comments
 (0)