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

reject metric event with invalid timestamp for sls serializer && fix serialization error with empty event #2066

Merged
merged 8 commits into from
Feb 8, 2025

Conversation

henryzhx8
Copy link
Collaborator

@henryzhx8 henryzhx8 commented Feb 7, 2025

  1. 对于metric event,强制要求时间戳为10位,否则直接丢弃该事件;
  2. event group里log event和raw event部分为空时,会出现序列化异常的情况,对该问题进行了修复;
  3. 为了便于排查问题,增加一段临时的debug代码,等序列化功能稳定后会删除。

@henryzhx8 henryzhx8 changed the title reject metric event with invalid timestamp for sls serializer reject metric event with invalid timestamp for sls serializer && fix serialization error with empty event Feb 8, 2025
@@ -116,13 +119,19 @@ bool SLSEventGroupSerializer::Serialize(BatchedEvents&& group, string& res, stri
case PipelineEvent::Type::METRIC: {
for (size_t i = 0; i < group.mEvents.size(); ++i) {
const auto& e = group.mEvents[i].Cast<MetricEvent>();
if (e.GetTimestamp() < 1e9) {
LOG_WARNING(sLogger,
Copy link
Collaborator

Choose a reason for hiding this comment

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

这种丢数据的,不能只有本地日志吧,得上报alarm

Copy link
Collaborator

Choose a reason for hiding this comment

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

数据面要梳理下哪些需要上报alarm,得自己在发布过程中提前发现问题

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

alarm需要先把错误码的规范明确一下,这个涉及报表制作,现有的错误码太随意了,动不动就随便加一个,所以暂时性没加alarm,只有warning,但是这个事情也需要尽快启动。

@@ -116,13 +119,19 @@ bool SLSEventGroupSerializer::Serialize(BatchedEvents&& group, string& res, stri
case PipelineEvent::Type::METRIC: {
for (size_t i = 0; i < group.mEvents.size(); ++i) {
const auto& e = group.mEvents[i].Cast<MetricEvent>();
if (e.GetTimestamp() < 1e9) {
LOG_WARNING(sLogger,
Copy link
Collaborator

Choose a reason for hiding this comment

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

数据面要梳理下哪些需要上报alarm,得自己在发布过程中提前发现问题

if (!logGroup.ParseFromString(res)) {
JsonEventGroupSerializer ser(const_cast<Flusher*>(mFlusher));
string jsonStr;
ser.DoSerialize(std::move(group), jsonStr, errorMsg);
Copy link
Collaborator

Choose a reason for hiding this comment

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

返回码判断

@henryzhx8 henryzhx8 merged commit b204b20 into main Feb 8, 2025
14 of 15 checks passed
@henryzhx8 henryzhx8 added the bug Something isn't working label Feb 8, 2025
@henryzhx8 henryzhx8 added this to the v3.0 milestone Feb 8, 2025
@henryzhx8 henryzhx8 deleted the fix/serializer branch February 8, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants