Skip to content

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

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)

@sonarqubecloud
Copy link

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
@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.

3 participants