From 9ed60fc2a647cad5997009154f8360f135cbb09e Mon Sep 17 00:00:00 2001 From: liqiang Date: Mon, 13 Jan 2025 01:37:32 +0000 Subject: [PATCH 1/2] fix the error of metric pb_list --- core/plugin/flusher/sls/FlusherSLS.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/core/plugin/flusher/sls/FlusherSLS.cpp b/core/plugin/flusher/sls/FlusherSLS.cpp index b5b91c6704..515823ca13 100644 --- a/core/plugin/flusher/sls/FlusherSLS.cpp +++ b/core/plugin/flusher/sls/FlusherSLS.cpp @@ -656,15 +656,19 @@ bool FlusherSLS::BuildRequest(SenderQueueItem* item, unique_ptr data->mCurrentHost = host; #endif - switch (mTelemetryType) { - case sls_logs::SLS_TELEMETRY_TYPE_LOGS: - req = CreatePostLogStoreLogsRequest(accessKeyId, accessKeySecret, type, data); - break; - case sls_logs::SLS_TELEMETRY_TYPE_METRICS: - req = CreatePostMetricStoreLogsRequest(accessKeyId, accessKeySecret, type, data); - break; - default: - break; + if (data->mType == RawDataType::EVENT_GROUP) { + switch (mTelemetryType) { + case sls_logs::SLS_TELEMETRY_TYPE_LOGS: + req = CreatePostLogStoreLogsRequest(accessKeyId, accessKeySecret, type, data); + break; + case sls_logs::SLS_TELEMETRY_TYPE_METRICS: + req = CreatePostMetricStoreLogsRequest(accessKeyId, accessKeySecret, type, data); + break; + default: + break; + } + } else { + req = CreatePostLogStoreLogsRequest(accessKeyId, accessKeySecret, type, data); } return true; } From 0f74ed251f7d01d75c899f40a3b86e143ca6dfbe Mon Sep 17 00:00:00 2001 From: liqiang Date: Mon, 13 Jan 2025 01:58:06 +0000 Subject: [PATCH 2/2] fix: metric pb_list --- core/plugin/flusher/sls/DiskBufferWriter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/plugin/flusher/sls/DiskBufferWriter.cpp b/core/plugin/flusher/sls/DiskBufferWriter.cpp index fd4c8117d9..d1c0b0b7e9 100644 --- a/core/plugin/flusher/sls/DiskBufferWriter.cpp +++ b/core/plugin/flusher/sls/DiskBufferWriter.cpp @@ -866,7 +866,8 @@ SLSResponse DiskBufferWriter::SendBufferFileData(const sls_logs::LogtailBufferMe } else { dataType = RawDataType::EVENT_GROUP; } - if (bufferMeta.has_telemetrytype() && bufferMeta.telemetrytype() == sls_logs::SLS_TELEMETRY_TYPE_METRICS) { + if (bufferMeta.has_telemetrytype() && bufferMeta.telemetrytype() == sls_logs::SLS_TELEMETRY_TYPE_METRICS + && dataType == RawDataType::EVENT_GROUP) { return PostMetricStoreLogs(accessKeyId, accessKeySecret, type,