Skip to content

ADFA-2951: [Computer vision] Skip Analytics event on Debug mode#989

Merged
Daniel-ADFA merged 1 commit intostagefrom
ADFA-2951
Feb 17, 2026
Merged

ADFA-2951: [Computer vision] Skip Analytics event on Debug mode#989
Daniel-ADFA merged 1 commit intostagefrom
ADFA-2951

Conversation

@Daniel-ADFA
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough
  • Computer Vision: Skip Firebase Analytics events in debug builds by adding a guard in CvAnalyticsUtils.logEvent that returns early when BuildConfig.DEBUG is true. Logs an info message instead. No public API changes.

Risks / best practices:

  • QA impact: Analytics from debug builds won’t appear in staging dashboards; ensure QA uses non-debug builds if event validation is required.
  • BuildConfig.DEBUG in library code can be unreliable depending on AGP/version and module boundaries. Consider centralizing analytics enablement (e.g., FirebaseAnalytics.setAnalyticsCollectionEnabled in the app layer), using a runtime flag (BuildConfig from the app module or ApplicationInfo.FLAG_DEBUGGABLE), or DI to pass the environment.
  • Ensure the info log does not include sensitive event data.
  • Add/adjust tests to verify no analytics are sent in debug builds and still sent in release builds.

Walkthrough

This PR introduces a debug mode guard in the logEvent method of CvAnalyticsUtils to prevent Firebase analytics events from being logged during development builds. When BuildConfig.DEBUG is true, the method returns early after logging an info message, skipping analytics transmission.

Changes

Cohort / File(s) Summary
Analytics Debug Guard
cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/utils/CvAnalyticsUtils.kt
Added conditional check to skip Firebase analytics logging when BuildConfig.DEBUG is true, preventing debug events from polluting analytics data.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • jatezzz

Poem

🐰 Hops through logs with careful grace,
Debug events find their place—
Firebase sleeps when testing reigns,
Clean analytics, true remains.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to evaluate relevance to the changeset. Add a pull request description explaining the rationale for skipping analytics in debug mode and any testing performed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: skipping Firebase analytics events in debug mode.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ADFA-2951

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/utils/CvAnalyticsUtils.kt (1)

29-31: Include eventName in the skip log for easier Logcat filtering.

The current message gives no indication of which event was suppressed. Including the event name makes it straightforward to confirm specific tracking calls are being hit during development.

♻️ Proposed improvement
-        if (BuildConfig.DEBUG) {
-            Log.i(TAG, "skipping analytics event on Debug build")
-            return
-        }
+        if (BuildConfig.DEBUG) {
+            Log.i(TAG, "Skipping analytics event '$eventName' on debug build")
+            return
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/utils/CvAnalyticsUtils.kt`
around lines 29 - 31, The debug skip log in CvAnalyticsUtils.kt currently logs
"skipping analytics event on Debug build" without identifying which event;
update the Log.i call inside the if (BuildConfig.DEBUG) block to include the
eventName variable (e.g., Log.i(TAG, "skipping analytics event on Debug build: "
+ eventName)) so you can filter by event in Logcat; ensure you reference the
existing TAG and eventName symbols used in the surrounding analytics method.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/utils/CvAnalyticsUtils.kt`:
- Around line 29-31: The debug skip log in CvAnalyticsUtils.kt currently logs
"skipping analytics event on Debug build" without identifying which event;
update the Log.i call inside the if (BuildConfig.DEBUG) block to include the
eventName variable (e.g., Log.i(TAG, "skipping analytics event on Debug build: "
+ eventName)) so you can filter by event in Logcat; ensure you reference the
existing TAG and eventName symbols used in the surrounding analytics method.

Copy link
Contributor

@avestaadfa avestaadfa left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@Daniel-ADFA Daniel-ADFA merged commit 2651ede into stage Feb 17, 2026
2 checks passed
@Daniel-ADFA Daniel-ADFA deleted the ADFA-2951 branch February 17, 2026 21:21
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.

2 participants