Skip to content

fix: running telemetry methods on initialized list only #1163

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

Merged
merged 2 commits into from
Sep 29, 2021

Conversation

anandtiwary
Copy link
Contributor

@anandtiwary anandtiwary commented Sep 29, 2021

Description

Please include a summary of the change, motivation and context.
fix: running telemetry methods on initialized list only

Testing

Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

Documentation

Make sure that you have documented corresponding changes in this repository or hypertrace docs repo if required.

@anandtiwary anandtiwary requested a review from a team as a code owner September 29, 2021 20:20
@@ -29,31 +30,32 @@ export class UserTelemetryImplService extends UserTelemetryService {
}

public initialize(): void {
this.telemetryProviders.forEach(provider => provider.telemetryProvider.initialize(provider.initConfig));
this.allTelemetryProviders.forEach(provider => provider.telemetryProvider.initialize(provider.initConfig));
this.initializedTelemetryProviders = [...this.allTelemetryProviders];
Copy link
Contributor

Choose a reason for hiding this comment

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

what are we trying to solve here? were we calling before initializing? That's the only behavior that I see that would change here. Wouldn't that imply a misconfig though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, we don't 'initialize' telemetry when FF is disabled or when user is an internal user. But the track directive still pushes click events on the service. Our E2E tests fails when it sees any console error. In this case, the third party lib throws an error since we tried to send an 'event' without initializing the library.

Copy link
Contributor Author

@anandtiwary anandtiwary Sep 29, 2021

Choose a reason for hiding this comment

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

The other alternative is to put an init check in every method that will run every time the track event methods are called. We can avoid that by keeping a separate initialized list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still, a perf hit. But an ideal solution would be to load the entire module only if the feature flag is enabled.

@github-actions

This comment has been minimized.

@codecov
Copy link

codecov bot commented Sep 29, 2021

Codecov Report

Merging #1163 (f24a6e7) into main (acc8cc4) will decrease coverage by 0.00%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1163      +/-   ##
==========================================
- Coverage   85.04%   85.04%   -0.01%     
==========================================
  Files         831      831              
  Lines       17207    17210       +3     
  Branches     2235     2235              
==========================================
+ Hits        14634    14636       +2     
- Misses       2541     2542       +1     
  Partials       32       32              
Impacted Files Coverage Δ
...ommon/src/telemetry/user-telemetry-impl.service.ts 90.47% <81.81%> (-1.84%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acc8cc4...f24a6e7. Read the comment docs.

@anandtiwary anandtiwary requested a review from a team September 29, 2021 20:31
@github-actions

This comment has been minimized.

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld left a comment

Choose a reason for hiding this comment

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

Discussed offline. Will take this approach for now, in the future we should investigate splitting behavior so that we can differentiate between all of:

  • enabled but not ready (error any calls)
  • disabled (drop calls)
  • enabled (forward calls)

@anandtiwary anandtiwary merged commit b65d383 into main Sep 29, 2021
@anandtiwary anandtiwary deleted the telemtery-initialized-list branch September 29, 2021 21:11
@github-actions
Copy link

Unit Test Results

    4 files  ±0  270 suites  ±0   17m 19s ⏱️ - 1m 42s
968 tests ±0  968 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
975 runs  ±0  975 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b65d383. ± Comparison against base commit acc8cc4.

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