Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Zipkin AddEvent() timestamp #896

Merged
merged 3 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exporters/zipkin/src/recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void Recordable::AddEvent(nostd::string_view name,
});

nlohmann::json annotation = {{"value", nlohmann::json::object({{name.data(), attrs}}).dump()},
{"timestamp", std::chrono::duration_cast<std::chrono::milliseconds>(
{"timestamp", std::chrono::duration_cast<std::chrono::microseconds>(
timestamp.time_since_epoch())
.count()}};

Expand Down
4 changes: 2 additions & 2 deletions exporters/zipkin/test/zipkin_recordable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ TEST(ZipkinSpanRecordable, AddEventDefault)
rec.opentelemetry::sdk::trace::Recordable::AddEvent(name, event_timestamp);

uint64_t unix_event_time =
std::chrono::duration_cast<std::chrono::milliseconds>(event_time.time_since_epoch()).count();
std::chrono::duration_cast<std::chrono::microseconds>(event_time.time_since_epoch()).count();

json j_span = {
{"annotations",
Expand All @@ -149,7 +149,7 @@ TEST(ZipkinSpanRecordable, AddEventWithAttributes)
std::chrono::system_clock::time_point event_time = std::chrono::system_clock::now();
opentelemetry::common::SystemTimestamp event_timestamp(event_time);
uint64_t unix_event_time =
std::chrono::duration_cast<std::chrono::milliseconds>(event_time.time_since_epoch()).count();
std::chrono::duration_cast<std::chrono::microseconds>(event_time.time_since_epoch()).count();

const int kNumAttributes = 3;
std::string keys[kNumAttributes] = {"attr1", "attr2", "attr3"};
Expand Down