Skip to content

Commit d3679b1

Browse files
authored
impl(storage): explicitly cast span data to supported common::AttributeValue type (#15119)
1 parent 1a7e550 commit d3679b1

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

google/cloud/storage/internal/async/object_descriptor_reader_tracing.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ObjectDescriptorReaderTracing : public ObjectDescriptorReader {
5757
"gl-cpp.read-range",
5858
{{/*sc::kRpcMessageType=*/"rpc.message.type", "RECEIVED"},
5959
{sc::kThreadId, internal::CurrentThreadId()},
60-
{"message.size", payload.size()}});
60+
{"message.size", static_cast<std::uint32_t>(payload.size())}});
6161
} else {
6262
span->AddEvent(
6363
"gl-cpp.read-range",

google/cloud/storage/internal/async/object_descriptor_reader_tracing_test.cc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ TEST(ObjectDescriptorReaderTracing, Read) {
6060

6161
auto actual = reader->Read().get();
6262
auto spans = span_catcher->GetSpans();
63-
EXPECT_THAT(spans, ElementsAre(AllOf(
64-
SpanNamed("storage::AsyncConnection::ReadObjectRange"),
65-
SpanHasEvents(AllOf(
66-
EventNamed("gl-cpp.read-range"),
67-
SpanEventAttributesAre(
68-
OTelAttribute<std::size_t>("message.size", 10),
69-
OTelAttribute<std::string>(sc::kThreadId, _),
70-
OTelAttribute<std::string>("rpc.message.type",
71-
"RECEIVED")))))));
63+
EXPECT_THAT(
64+
spans, ElementsAre(
65+
AllOf(SpanNamed("storage::AsyncConnection::ReadObjectRange"),
66+
SpanHasEvents(AllOf(
67+
EventNamed("gl-cpp.read-range"),
68+
SpanEventAttributesAre(
69+
OTelAttribute<std::uint32_t>("message.size", 10),
70+
OTelAttribute<std::string>(sc::kThreadId, _),
71+
OTelAttribute<std::string>("rpc.message.type",
72+
"RECEIVED")))))));
7273
}
7374

7475
TEST(ObjectDescriptorReaderTracing, ReadError) {

0 commit comments

Comments
 (0)