Skip to content

Conversation

@AditiSah05
Copy link

@AditiSah05 AditiSah05 commented Dec 7, 2025

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #531 .

Please open a new issue if there isn't an existing issue yet.

Description of Changes

This pull request introduces a reliable mechanism to ensure that metric usage data is sent only once per day, addressing the issue of duplicate submissions caused by repeated executions in certain Django configurations.

To achieve this, the system now generates a hash of the daily metric payload and stores it along with the current date. When metrics are generated again on the same day, the stored hash is compared with the new one. If the payload is unchanged, the system simply skips the transmission. This prevents unnecessary duplication while keeping the reporting behavior consistent and lightweight.

In addition to the core logic, the following updates have been made:

-Added a persistent storage step for recording the daily payload hash.

-Implemented comparison logic to detect and prevent repeated submissions within the same day.

-Added and updated test cases to validate the new behavior, including hash creation, daily checks, and skip conditions.

-Updated the documentation to clearly explain the new flow and provide guidance on correct configuration.

Screenshot

This change does not modify any user-facing interface, so no screenshot is required.

@AditiSah05
Copy link
Author

Hi @pandafy ,
I’ve completed the changes and submitted the pull request. Whenever you have a moment, could you please review it and share your feedback?
Thank you!

@AditiSah05 AditiSah05 changed the title Prevent Duplicate Metric Usage Reports by Adding Daily Payload Hashing Prevent Duplicate Metric Usage Reports by Adding Daily Payload Hashing #531 Dec 7, 2025
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.

[feature] Avoid sending duplicate usage metrics

1 participant