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: add a send-usage-report button in the django admin #25839

Merged
merged 9 commits into from
Oct 28, 2024

Conversation

patricio-posthog
Copy link
Contributor

Problem

When there is a failure with the command send_usage_report, we need to access the server to run the command manually. Adding this button to the Django admin would allow us to do it using the UI, without the need to ssh into one of the pods.

Changes

  1. New migration that creates a user group called Billing Team
  2. New button in Django admin that allows users that belong to the Billing Team to run the send_usage_report command.

New button:
Screenshot 2024-10-25 at 5 21 53 PM

Form to pick the date before running it:
Screenshot 2024-10-25 at 5 22 22 PM

Date cannot be in the future
Screenshot 2024-10-25 at 5 22 52 PM

Success message
Screenshot 2024-10-25 at 5 23 19 PM

If the user do not belong to Billing Team, this is the error message when clicks in the button:
Screenshot 2024-10-25 at 5 24 03 PM

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

I run it manually locally.

{% endfor %}
</fieldset>
<div class="submit-row">
<input type="submit" value="Send Usage Report" class="default" name="_send_report">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just add a note here about how you need to send the next day? Like the one noted here, https://posthog.com/handbook/engineering/usage_reports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea. I just added a text and a link to the handbook.

@patricio-posthog patricio-posthog merged commit 90585cd into master Oct 28, 2024
87 checks passed
@patricio-posthog patricio-posthog deleted the patricio/send-usage-report-admin-button branch October 28, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants