Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Nov 24, 2024
1 parent d160f8a commit 9db948d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions sdk/include/opentelemetry/sdk/trace/span_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ class SpanData final : public Recordable
}

void AddEvent(nostd::string_view name,
opentelemetry::common::SystemTimestamp timestamp,
const opentelemetry::common::KeyValueIterable &attributes) noexcept override
opentelemetry::common::SystemTimestamp timestamp =
opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now()),
const opentelemetry::common::KeyValueIterable &attributes =
opentelemetry::common::KeyValueIterableView<std::map<std::string, int32_t>>) noexcept override
{
SpanDataEvent event(std::string(name), timestamp, attributes);
events_.push_back(event);
Expand Down
3 changes: 1 addition & 2 deletions sdk/test/trace/span_data_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ TEST(SpanData, Set)
data.SetStartTime(now);
data.SetDuration(std::chrono::nanoseconds(1000000));
data.SetAttribute("attr1", static_cast<int64_t>(314159));
data.AddEvent("event1", now,
opentelemetry::common::KeyValueIterableView<std::map<std::string, int32_t>>({}));
data.AddEvent("event1", now);

ASSERT_EQ(data.GetTraceId(), trace_id);
ASSERT_EQ(data.GetSpanId(), span_id);
Expand Down

0 comments on commit 9db948d

Please sign in to comment.