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(analytics): Add command to migrate analytics data to pg #3981

Merged
merged 3 commits into from
May 30, 2024

Conversation

gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented May 19, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Add command to migrate feature analytics data from InfluxDB to Postgres

How did you test this code?

Tested manually with an external InfluxDB and added a unit test.

Copy link

vercel bot commented May 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2024 9:31am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2024 9:31am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2024 9:31am

Copy link
Contributor

github-actions bot commented May 19, 2024

Uffizzi Preview deployment-51971 was deleted.

Add command to migrate feature analytics data from influxdb
to postgres
Copy link

codecov bot commented May 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.42%. Comparing base (87e68c4) to head (3d20d32).
Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3981    +/-   ##
========================================
  Coverage   96.41%   96.42%            
========================================
  Files        1145     1148     +3     
  Lines       37303    37430   +127     
========================================
+ Hits        35967    36092   +125     
- Misses       1336     1338     +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gagantrivedi gagantrivedi requested a review from a team May 28, 2024 08:34
@gagantrivedi gagantrivedi requested review from zachaysan and removed request for a team May 28, 2024 08:34
Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

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

Some minor nits, but overall looks great.

api/app_analytics/management/commands/migrate_analytics.py Outdated Show resolved Hide resolved
from app_analytics.models import FeatureEvaluationBucket


def migrate_feature_evaluations(migrate_till: int = 30):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def migrate_feature_evaluations(migrate_till: int = 30):
def migrate_feature_evaluations(migrate_till: int = 30) -> None:

reason="Skip test if analytics database is not configured",
)
@pytest.mark.django_db(databases=["analytics", "default"])
def test_migrate_feature_evaluations(mocker: MockerFixture):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def test_migrate_feature_evaluations(mocker: MockerFixture):
def test_migrate_feature_evaluations(mocker: MockerFixture) -> None:

def test_migrate_feature_evaluations(mocker: MockerFixture):
# Given
feature_name = "test_feature_one"
environment_id = "1"
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels odd to me that environment_id is set to a string here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, but unfortunately this is the data type our functions expects (historical reasons)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants