Skip to content

Commit f15d3ae

Browse files
yunhanw-googlerestyled-commitsbzbarsky-apple
authored
Improve logging around report chunking (project-chip#32731)
* Improve logging around report chunking * address comments * Restyled by whitespace * Restyled by clang-format * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update src/app/reporting/Engine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> * Update Engine.cpp * Update Engine.cpp * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent a0f8726 commit f15d3ae

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/app/reporting/Engine.cpp

+17-4
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,16 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu
204204
pathForRetrieval, &encodeState);
205205
if (err != CHIP_NO_ERROR)
206206
{
207-
ChipLogError(DataManagement,
208-
"Error retrieving data from clusterId: " ChipLogFormatMEI ", err = %" CHIP_ERROR_FORMAT,
209-
ChipLogValueMEI(pathForRetrieval.mClusterId), err.Format());
210-
211207
// If error is not an "out of writer space" error, rollback and encode status.
212208
// Otherwise, if partial data allowed, save the encode state.
213209
// Otherwise roll back. If we have already encoded some chunks, we are done; otherwise encode status.
214210

215211
if (encodeState.AllowPartialData() && IsOutOfWriterSpaceError(err))
216212
{
213+
ChipLogDetail(DataManagement,
214+
"List does not fit in packet, chunk between list items for clusterId: " ChipLogFormatMEI
215+
", attributeId: " ChipLogFormatMEI,
216+
ChipLogValueMEI(pathForRetrieval.mClusterId), ChipLogValueMEI(pathForRetrieval.mAttributeId));
217217
// Encoding is aborted but partial data is allowed, then we don't rollback and save the state for next chunk.
218218
// The expectation is that RetrieveClusterData has already reset attributeReportIBs to a good state (rolled
219219
// back any partially-written AttributeReportIB instances, reset its error status). Since AllowPartialData()
@@ -230,6 +230,11 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu
230230

231231
if (!IsOutOfWriterSpaceError(err))
232232
{
233+
ChipLogError(DataManagement,
234+
"Fail to retrieve data, roll back and encode status on clusterId: " ChipLogFormatMEI
235+
", attributeId: " ChipLogFormatMEI "err = %" CHIP_ERROR_FORMAT,
236+
ChipLogValueMEI(pathForRetrieval.mClusterId), ChipLogValueMEI(pathForRetrieval.mAttributeId),
237+
err.Format());
233238
// Try to encode our error as a status response.
234239
err = attributeReportIBs.EncodeAttributeStatus(pathForRetrieval, StatusIB(err));
235240
if (err != CHIP_NO_ERROR)
@@ -239,6 +244,14 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu
239244
attributeReportIBs.Rollback(attributeBackup);
240245
}
241246
}
247+
else
248+
{
249+
ChipLogDetail(DataManagement,
250+
"Next attribute value does not fit in packet, roll back on clusterId: " ChipLogFormatMEI
251+
", attributeId: " ChipLogFormatMEI ", err = %" CHIP_ERROR_FORMAT,
252+
ChipLogValueMEI(pathForRetrieval.mClusterId), ChipLogValueMEI(pathForRetrieval.mAttributeId),
253+
err.Format());
254+
}
242255
}
243256
}
244257
SuccessOrExit(err);

0 commit comments

Comments
 (0)