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

Add download count tracking to asset blobs #1570

Merged
merged 4 commits into from
May 15, 2023
Merged

Conversation

danlamanna
Copy link
Contributor

Related #1424.

This PR adds S3 server-side log processing to track the number of downloads per asset blob. The plan is to do an initial ingest and then set up a scheduled beat task to run this at some interval. For now, this increments the counters in the database and avoids exposing it in the GUI or aggregating these figures anywhere.

Copy link
Member

@jjnesbitt jjnesbitt left a comment

Choose a reason for hiding this comment

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

Looks good overall, just a few comments

dandiapi/analytics/models.py Show resolved Hide resolved
dandiapi/settings.py Show resolved Hide resolved
dandiapi/analytics/tests/test_download_counts.py Outdated Show resolved Hide resolved
@danlamanna danlamanna force-pushed the asset-download-counts branch 2 times, most recently from c6c658c to fb4ebf7 Compare April 11, 2023 22:04
@danlamanna danlamanna added patch Increment the patch version when merged release Create a release when this pr is merged labels May 15, 2023
@danlamanna danlamanna merged commit c81c7c5 into master May 15, 2023
@danlamanna danlamanna deleted the asset-download-counts branch May 15, 2023 17:31
@dandibot
Copy link
Member

🚀 PR was released in v0.3.35 🚀

@dandibot dandibot added the released This issue/pull request has been released. label May 15, 2023
@@ -56,6 +56,7 @@ class BaseAssetBlob(TimeStampedModel):
)
etag = models.CharField(max_length=40, validators=[RegexValidator(f'^{ETAG_REGEX}$')])
size = models.PositiveBigIntegerField()
download_count = models.PositiveBigIntegerField(default=0)
Copy link
Member

Choose a reason for hiding this comment

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

where in the API could I see/get those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants