Skip to content

[Fireperf][Fixit] Change AppStartTrace from singleton to normal object #4186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leotianlizhan
Copy link
Contributor

@leotianlizhan leotianlizhan commented Oct 7, 2022

Description

b/251844673
De-singleton AppStartTrace. This is the lowest hanging fruit since it only has one single dependee.

Side effect / additional benefit

De-singletoning this hides AppStartTrace.getInstance() from customers. That is an undocumented and unsupported API, and customers can technically mess with it and call methods they are not supposed to call. This PR makes it impossible for customers to call its method and break app-start trace in unexpected ways.

Analysis: Object Lifetime (is it safe to de-singleton AppStartTrace?)

TLDR: yes, because Android platform's Application will hold a reference to AppStartTrace until the trace completes.
out

@google-oss-bot
Copy link
Contributor

1 Warning
⚠️ Did you forget to add a changelog entry? (Add the 'no-changelog' label to the PR to silence this warning.)

Generated by 🚫 Danger

@google-oss-bot
Copy link
Contributor

Coverage Report 1

Affected Products

  • firebase-perf

    Overall coverage changed from 71.13% (fa4adcf) to 71.12% (f1da118) by -0.02%.

    FilenameBase (fa4adcf)Merge (f1da118)Diff
    AppStartTrace.java85.19%84.73%-0.45%

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/ZmGPYvKdi2.html

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

Unit Test Results

  51 files   -    344    51 suites   - 344   2m 11s ⏱️ - 18m 39s
974 tests  - 3 744  974 ✔️  - 3 720  0 💤  - 22  0  - 2 
974 runs   - 3 760  974 ✔️  - 3 736  0 💤  - 22  0  - 2 

Results for commit 395b563. ± Comparison against base commit fa4adcf.

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • firebase-datatransport

    TypeBase (fa4adcf)Merge (f1da118)Diff
    apk (aggressive)136 kB132 kB-4.10 kB (-3.0%)
  • firebase-perf

    TypeBase (fa4adcf)Merge (f1da118)Diff
    aar311 kB311 kB-151 B (-0.0%)
    apk (aggressive)1.03 MB1.03 MB-76 B (-0.0%)
    apk (release)2.47 MB2.47 MB-156 B (-0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/xweSHD0I5I.html

}
}
return instance;
public AppStartTrace() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if "De-singletoning this hides AppStartTrace.getInstance() from customers. " Customers can still call new AppStartTrace() I think.

Copy link
Contributor

@visumickey visumickey left a comment

Choose a reason for hiding this comment

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

Are there any changes to the unit tests that need to accompany this change? We seem to be changing the way we allow to create/access AppStartTrace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants