Skip to content
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

feat: standalone check for telemetry enabled #274

Merged
merged 5 commits into from
Aug 14, 2023

Conversation

mshanemc
Copy link
Contributor

@mshanemc mshanemc commented Aug 11, 2023

What does this PR do?

if you want to check if telemetry is enabled, there were a lot of perf-killing side effects

  • requiring appInsights
  • configAgg => all of sfdx-core => all of jsforce

This change

  • do the enabled check in a standalone function that memoizes the result
  • put the enabledCheck as a top-level export. You can import just that instead of all of exported.ts
  • re-use the memoized check in the telemetryReporter class, removing the static OOP tricks needed used to persist that state (and deprecate the static method)
  • since some methods aren't async, store the result in the class so sync instance methods can access it

No breaking changes intended. Verify that the pjson exports prop doesn't break consumers.

What issues does this PR fix or reference?

@W-13931029@

QA: I shipped a CLI prerel to validate with (2.5.2-qa.0)
verify things are still getting to AppInsights (hint: search using your cliid)

run DEBUG=perf sf config list a few times, looking for something like @salesforce/plugin-telemetry(./lib/hooks/telemetryPrerun.js): 312.1893ms

@mshanemc mshanemc changed the title Sm/standlone-enabled-check feat: standalone check for telemetry enabled Aug 11, 2023
@mdonnalley mdonnalley merged commit bb4999f into main Aug 14, 2023
8 checks passed
@mdonnalley mdonnalley deleted the sm/standlone-enabled-check branch August 14, 2023 19:13
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.

3 participants