Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: disable nanosecond timestamp when only EnableTimestampNanosecond is enabled #1528

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

henryzhx8
Copy link
Collaborator

  • 问题:启用EnableTimestampNanosecond但使用系统时间时,logGroup的time_ns仍然会被赋值0,前端展示会多9个0,后端认为开启纳秒功能进而降低查询性能。

注:本PR只解决C++部分的问题,Golang部分待 @Abingcbc 确认。

@henryzhx8 henryzhx8 added this to the v2.0 milestone Jun 7, 2024
@henryzhx8 henryzhx8 added the bug Something isn't working label Jun 7, 2024
@@ -138,7 +138,9 @@ Json::Value LogEvent::ToJson(bool enableEventMeta) const {
Json::Value root;
root["type"] = static_cast<int>(GetType());
root["timestamp"] = GetTimestamp();
root["timestampNanosecond"] = GetTimestampNanosecond();
if (GetTimestampNanosecond()) {
root["timestampNanosecond"] = static_cast<int32_t>(GetTimestampNanosecond().value());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的类型是不是也可以统一成uint32_t?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json不认识uint,只认识int,不这样搞的话,在单测那里,会出现uint != int的情况,只能强制转成int

@henryzhx8 henryzhx8 merged commit 65d75b0 into main Jun 7, 2024
15 checks passed
@henryzhx8 henryzhx8 deleted the fix/nano branch June 7, 2024 08:51
linrunqi08 pushed a commit that referenced this pull request Jun 18, 2024
… is enabled (#1528)

* fix: disable nanosecond timestamp when only EnableTimestampNanosecond is enabled
henryzhx8 added a commit that referenced this pull request Jun 19, 2024
linrunqi08 pushed a commit that referenced this pull request Jun 20, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants