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

[1.x] Add Configurable Trim Duration for Pulse Data Storage #424

Merged
merged 5 commits into from
Nov 29, 2024

Conversation

tharlei
Copy link
Contributor

@tharlei tharlei commented Nov 28, 2024

Description

This pull request introduces a configurable option to define how long Pulse data should be retained in the database. Previously, the retention period was hardcoded to 7 days. With this update, developers can now specify the desired duration through configuration.

PULSE_INGEST_KEEP="1 week" #example

Benefits to End Users

  1. Flexibility: Allows developers to adjust the data retention period based on project needs.
  2. Compatibily: Pulse already automatically clears out old data.
  3. Scalability: Helps optimize database usage by tailoring retention settings to different environments (e.g., production vs. development).

Key Points

  • Default retention period remains unchanged unless explicitly configured.
  • Fully backward-compatible, ensuring no breakage in existing implementations.

Let me know if any adjustments are required.

@timacdonald
Copy link
Member

timacdonald commented Nov 28, 2024

We already have an option to trim the ingest length. Trimming happens automatically.

We also already trim the storage, e.g., database, however it is hard coded to 7 days of data.

If we wanted to support this feature, think I would prefer we match the existing pattern in Pulse and introduce a configurable trim duration for storage.

Then you don't need to run this command. Pulse automatically clear things out after they become too old.

@tharlei tharlei changed the title [1.x] Add Prune Command for Pulse Project [1.x] Add environment to keep data in Database Storage Nov 29, 2024
@tharlei tharlei changed the title [1.x] Add environment to keep data in Database Storage [1.x] Add Configurable Trim Duration for Pulse Data Storage Nov 29, 2024
@tharlei
Copy link
Contributor Author

tharlei commented Nov 29, 2024

We already have an option to trim the ingest length. Trimming happens automatically.

We also already trim the storage, e.g., database, however it is hard coded to 7 days of data.

If we wanted to support this feature, think I would prefer we match the existing pattern in Pulse and introduce a configurable trim duration for storage.

Then you don't need to run this command. Pulse automatically clear things out after they become too old.

Great @timacdonald! Now I see that the trim() method is already being applied to each inserted data.

Taking the opportunity, I applied your suggestion to remove the hardcoded 7-day value from the code and implement a configuration for it. I used the same configuration that is already set in Redis.

Follow commit

And thanks for the support 😄

@taylorotwell taylorotwell merged commit 1ff6403 into laravel:1.x Nov 29, 2024
17 checks passed
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.

3 participants