Skip to content

Added EVT_DROPPED reason codes via param2#1452

Open
mogiligarimidi23 wants to merge 11 commits into
mainfrom
mogiligarimidi/dropouts_reasons_added
Open

Added EVT_DROPPED reason codes via param2#1452
mogiligarimidi23 wants to merge 11 commits into
mainfrom
mogiligarimidi/dropouts_reasons_added

Conversation

@mogiligarimidi23
Copy link
Copy Markdown

@mogiligarimidi23 mogiligarimidi23 commented May 27, 2026

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 — add EventDroppedReason codes:
    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 virtual
    GetRemainingRecordCountForShutdown() const with a default that returns
    GetRecordCount(). ABI note: existing third-party implementations of
    IOfflineStorage stay source-compatible but must be recompiled against
    this 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) now
    dispatches EVT_DROPPED with param1 = count and
    param2 = DROPPED_REASON_OFFLINE_STORAGE_OVERFLOW. Previously this
    branch 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

@mogiligarimidi23 mogiligarimidi23 requested a review from a team as a code owner May 27, 2026 17:59
@mogiligarimidi23 mogiligarimidi23 changed the title Add EVT_DROPPED reason codes via param2 Added EVT_DROPPED reason codes via param2 May 27, 2026
Comment thread lib/offline/StorageObserver.cpp Outdated
Comment thread lib/include/public/Enums.hpp Outdated
Comment thread lib/system/TelemetrySystem.cpp Outdated
@lalitb
Copy link
Copy Markdown
Contributor

lalitb commented May 28, 2026

Can we double-check other delete/drop paths too? For example, the SQLite “DB is too big” path does DELETE FROM events and returns before emitting EVT_DROPPED, so some drops may still have no reason code.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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) to EVT_DROPPED dispatches using DebugEvent.param2 across offline storage overflow/save-failure paths.
  • Emit an EVT_DROPPED event on teardown-timeout with the remaining record count and a new teardown-timeout reason code.
  • Extend EventDroppedReason with 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.

Comment thread lib/include/public/Enums.hpp Outdated
Comment thread lib/api/Logger.cpp
Comment thread lib/include/public/Version.hpp
Comment thread lib/system/TelemetrySystem.cpp Outdated
@bmehta001 bmehta001 requested a review from Copilot May 31, 2026 09:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comment thread lib/offline/OfflineStorage_SQLite.cpp Outdated
Comment thread lib/offline/OfflineStorage_SQLite.cpp
Comment thread lib/include/public/IOfflineStorage.hpp Outdated
Comment thread lib/include/public/IOfflineStorage.hpp Outdated
mogiligarimidi23 and others added 2 commits May 31, 2026 18:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread lib/include/public/Enums.hpp
Comment thread lib/offline/MemoryStorage.cpp
Comment thread lib/offline/MemoryStorage.hpp Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants