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

GSK-1963: ignore mixpanel errors #1502

Merged

Conversation

andreybavt
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Oct 24, 2023

GSK-1963 Swallow Mixpanel errors when they happen

If mixpanel doesn't work we shouldn't interrupt users

@@ -149,6 +146,7 @@ def track(self, event_name, properties=None, meta=None, force=False):
return self._track(event_name, properties=properties, meta=meta, force=force)

@threaded
@analytics_method
Copy link
Member

Choose a reason for hiding this comment

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

If I remember correctly, this was removed to avoid infinite loops. Can we add a test to ensure that this is not happening (since _report_error has been removed in the decorator, this should be the case) and make sure we will not reintroduce this in the future?

EDIT: maybe the test that is present already covers this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was actually the presence of

 _report_error(e, error_type="tracking error")

that was causing an infinite loop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added an extra test for analytics_method

@@ -0,0 +1,9 @@
from mixpanel import Consumer

from utils.analytics_collector import GiskardAnalyticsCollector
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
from utils.analytics_collector import GiskardAnalyticsCollector
from tests.utils.analytics_collector import GiskardAnalyticsCollector

@mattbit
Copy link
Member

mattbit commented Oct 25, 2023

@andreybavt I fixed the import, but the test is broken. Could you check?

@andreybavt
Copy link
Contributor Author

@mattbit the test should be fine now. It was caused by the way we run tests from pdm (by disabling analytics). That's why I wasn't having it locally (by running pytest directly)

@sonarcloud
Copy link

sonarcloud bot commented Oct 25, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@mattbit mattbit merged commit 27097e8 into main Oct 25, 2023
13 checks passed
@mattbit mattbit deleted the feature/gsk-1963-swallow-mixpanel-errors-when-they-happen branch October 25, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants