Skip to content

chore: add launch counter for Sentry reporting#7554

Merged
mikhail-dcl merged 4 commits intodevfrom
chore/launch_count
Apr 8, 2026
Merged

chore: add launch counter for Sentry reporting#7554
mikhail-dcl merged 4 commits intodevfrom
chore/launch_count

Conversation

@mikhail-dcl
Copy link
Copy Markdown
Collaborator

@mikhail-dcl mikhail-dcl commented Mar 13, 2026

Pull Request Description

has_identity alone doesn't recognize the first launch, as it will report false on re-login.

What does this PR change?

Adds a LaunchCounter class to the analytics domain that persists and increments a launch count across application runs via DCLPlayerPrefs. The count is attached as a tag to the Sentry loading transaction.

Key Changes

  • LaunchCounter static class in Assets/DCL/PerformanceAndDiagnostics/Analytics/ — reads, increments, and persists the count
  • DCLPrefKeys.LAUNCH_COUNT key for persistence
  • LaunchCounter.Increment() called from AnalyticsContainer.CreateAsync alongside CrashDetector.Initialize
  • launch_count tag added to the loading process Sentry transaction in LoadingStatusAnalyticsDecorator
  • has_identity and identity_expired tags also included in the same transaction

Test Instructions

Test Steps

  1. Launch the application
  2. Verify the launch_count tag appears on the loading_process Sentry transaction
  3. Close and relaunch — verify the count increments

Quality Checklist

  • Changes have been tested locally
  • Performance impact has been considered

@mikhail-dcl mikhail-dcl requested review from a team as code owners March 13, 2026 10:59
@github-actions github-actions Bot requested review from Ludmilafantaniella, dalkia and mihakrajnc and removed request for dalkia and mihakrajnc March 13, 2026 10:59
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 13, 2026

@mikhail-dcl mikhail-dcl added the no QA needed Used to tag pull requests that does not require QA validation label Apr 7, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 7, 2026

Claude finished @mikhail-dcl's task in 1m 27s —— View job


Code Review

  • Gather context and understand request
  • Read changed files
  • Analyze for bugs, code quality, and performance issues
  • Post review feedback

No issues found. The implementation is correct and clean.

Verification notes:

  • LaunchCounter.Increment() is inside if (container.Enabled) in AnalyticsContainer.cs:55, and LoadingStatusAnalyticsDecorator is only instantiated when enableAnalytics is true (StaticContainer.cs:194) — these are in sync, so Count is never 0 when the Sentry tag is written.
  • First launch: GetInt returns 0 → Count = 1, stored correctly.
  • Subsequent launches: count increments correctly from persisted value.
  • List initial capacity of 3 (LoadingStatusAnalyticsDecorator.cs:46) is accurate (max 3 tags).
  • No thread safety concerns — called from UniTask on Unity main thread.

REVIEW_RESULT: PASS ✅
COMPLEXITY: SIMPLE
QA_REQUIRED: YES

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Auto-approved by Claude — simple fix/chore with no blocking issues. QA approval is still required.

@mikhail-dcl mikhail-dcl enabled auto-merge (squash) April 8, 2026 09:26
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 8, 2026

Claude finished @mikhail-dcl's task in 1m 23s —— View job


Code Review

  • Gather context and understand request
  • Read changed files
  • Analyze for bugs, code quality, and performance issues
  • Post review feedback

No issues found. The implementation is correct and clean.

Verification notes:

  • Tags on TransactionData is IEnumerable<KeyValuePair<string, string>>? — assigning a List<T> is valid.
  • LaunchCounter.Increment() is inside if (container.Enabled) in AnalyticsContainer.cs:55, and LoadingStatusAnalyticsDecorator is only instantiated when enableAnalytics is true — these are in sync, so Count is never 0 when the Sentry tag is written.
  • First launch: GetInt returns 0 → Count = 1, stored correctly.
  • Subsequent launches: count increments correctly from persisted value.
  • List initial capacity of 3 (LoadingStatusAnalyticsDecorator.cs:46) is accurate (max 3 tags). Allocation only on Init stage — acceptable.
  • Removal of unused using JetBrains.Annotations; in DCLPrefKeys.cs is correct.

REVIEW_RESULT: PASS ✅
COMPLEXITY: SIMPLE
QA_REQUIRED: YES

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Auto-approved by Claude — simple fix/chore with no blocking issues. QA approval is still required.

@mikhail-dcl mikhail-dcl merged commit 777aca8 into dev Apr 8, 2026
13 checks passed
@mikhail-dcl mikhail-dcl deleted the chore/launch_count branch April 8, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-approved no QA needed Used to tag pull requests that does not require QA validation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants