Added EVT_DROPPED reason codes via param2#1452
Conversation
|
Can we double-check other delete/drop paths too? For example, the SQLite “DB is too big” path does |
There was a problem hiding this comment.
Pull request overview
This PR enhances observability of SDK-level event drops by attaching an EventDroppedReason code to existing EVT_DROPPED debug dispatches via DebugEvent.param2, and adds a new EVT_DROPPED dispatch for the teardown-timeout path. It also extends the public EventDroppedReason enum with two new reasons to cover previously un-attributable drop scenarios.
Changes:
- Attach drop reason codes (
EventDroppedReason) toEVT_DROPPEDdispatches usingDebugEvent.param2across offline storage overflow/save-failure paths. - Emit an
EVT_DROPPEDevent on teardown-timeout with the remaining record count and a new teardown-timeout reason code. - Extend
EventDroppedReasonwith teardown-timeout and profile-disabled-latency reasons; bump SDK build version.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/system/TelemetrySystem.cpp | Emits EVT_DROPPED with teardown-timeout reason and remaining record count when shutdown upload exceeds teardown budget. |
| lib/stats/Statistics.cpp | Adds param2 reason code for offline-storage save-failure EVT_DROPPED. |
| lib/offline/StorageObserver.cpp | Adds param2 reason code for offline-storage overflow EVT_DROPPED dispatches. |
| lib/offline/OfflineStorage_SQLite.cpp | Adds param2 reason code for SQLite trim/overflow EVT_DROPPED. |
| lib/offline/OfflineStorage_Room.cpp | Adds param2 reason code for Room trim/overflow EVT_DROPPED. |
| lib/include/public/Version.hpp | Updates generated build/version numbers. |
| lib/include/public/Enums.hpp | Adds new EventDroppedReason values (but currently introduces an enum COUNT inconsistency). |
| lib/api/Logger.cpp | Emits EVT_DROPPED with profile-disabled-latency reason when computed latency is Off. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…b.com/microsoft/cpp_client_telemetry into mogiligarimidi/dropouts_reasons_added
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
This PR makes SDK-level event drops observable by listeners by attaching a reason code to existing EVT_DROPPED dispatches via DebugEvent.param2, and adds a new dispatch for the previously-silent teardown-timeout path. Two newvalues are appended to EventDroppedReason for cases the existing enum doesn't cover.
The change is purely additive — no existing dispatch semantics are altered.
Motivation
Several EVT_DROPPED dispatch sites today emit only param1 = recordCount, leaving listeners unable to distinguish why records were dropped (storage trim vs. profile-disabled vs. teardown-timeout vs. storage-save-failed).Without that attribution, application-layer telemetry-health dashboards can only report "events dropped" but cannot point to the cause.
Changes
Public enum (lib/include/public/Enums.hpp)
Two new values appended after DROPPED_REASON_COUNT:
DROPPED_REASON_TEARDOWN_TIMEOUT,
DROPPED_REASON_LATENCY_DISABLED_BY_PROFILE
Public surface
lib/include/public/Enums.hpp— addEventDroppedReasoncodes:OFFLINE_STORAGE_SAVE_FAILED,OFFLINE_STORAGE_OVERFLOW,SERVER_DECLINED_4XX,SERVER_DECLINED_5XX,SERVER_DECLINED_OTHER,RETRY_EXCEEDED,TEARDOWN_TIMEOUT,LATENCY_DISABLED_BY_PROFILE.lib/include/public/IOfflineStorage.hpp— add non-pure virtualGetRemainingRecordCountForShutdown() constwith a default that returnsGetRecordCount(). ABI note: existing third-party implementations ofIOfflineStoragestay source-compatible but must be recompiled againstthis SDK version (the vtable grows). Documented in the method's
<remarks>.Behavior change (intentional)
lib/offline/OfflineStorage_SQLite.cpp— the catastrophic-resize branch(
m_DbSizeEstimate > 2 × m_DbSizeLimit, which deletes all events) nowdispatches
EVT_DROPPEDwithparam1 = countandparam2 = DROPPED_REASON_OFFLINE_STORAGE_OVERFLOW. Previously thisbranch returned silently with no drop telemetry. The trim branch
(≤ 2× limit) is unchanged.
Tests
No new tests; existing offline-storage and telemetry-system tests cover the
modified dispatch paths. Verified Windows and Android builds