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

2116 improve resilience of posthog integration #2148

Closed

Conversation

collinpreston
Copy link
Contributor

@collinpreston collinpreston commented Apr 3, 2024

What are the relevant tickets?

#2116

Description (What does it do?)

  1. Adds POSTHOG_FEATURE_FLAG_REQUEST_TIMEOUT_MS as an environment variable. Default is 3000 milliseconds.
  2. Adds POSTHOG_MAX_RETRIES as an environment variable. Default is 3.
  3. Defines feature_flags_request_timeout_seconds as an option when calling PostHog (https://posthog.com/docs/feature-flags/adding-feature-flag-code#request-timeout).
  4. Rename IN_TEST_SUITE to POSTHOG_ENABLED.

Testing

  1. PostHog functionality should not be impacted when running MITx Online locally. POSTHOG_ENABLED should be set to True locally.
  2. If you define POSTHOG_FEATURE_FLAG_REQUEST_TIMEOUT_MS=1 in your .env file and restart MITx Online. When you load the homepage you should not see any features that require the feature flags to be active.
  3. If you define POSTHOG_FEATURE_FLAG_REQUEST_TIMEOUT_MS=3000 in your .env file and restart MITx Online. When you load the homepage you should see features that require the feature flags to be active.

@collinpreston collinpreston linked an issue Apr 3, 2024 that may be closed by this pull request
@collinpreston collinpreston marked this pull request as ready for review April 3, 2024 18:02
@jkachel
Copy link
Contributor

jkachel commented Apr 3, 2024

I was looking through this and it seems pretty close to the implementation that's in Open. Rather than squaring these two implementations up, should they be merged and put instead into ol-django's common app? That way MITx Online and Open will have consistent implementations (and MITx Online would gain a local feature flag cache). Thoughts?

@collinpreston
Copy link
Contributor Author

I was looking through this and it seems pretty close to the implementation that's in Open. Rather than squaring these two implementations up, should they be merged and put instead into ol-django's common app? That way MITx Online and Open will have consistent implementations (and MITx Online would gain a local feature flag cache). Thoughts?

Sure that sounds good.

@collinpreston
Copy link
Contributor Author

Closing in favor of mitodl/ol-django#152 which will be followed up with an accompanying MITx Online PR to incorporate the ol-django PR.

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

Successfully merging this pull request may close these issues.

Improve resilience of posthog integration
3 participants