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

Automatically update ts_created & ts_last_edit when invalidating segment reports #22169

Closed
9joshua opened this issue Apr 29, 2024 · 1 comment
Labels
answered For when a question was asked and we referred to forum or answered it. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@9joshua
Copy link
Contributor

9joshua commented Apr 29, 2024

When processing additional historical data into segments there are two steps:

  1. Invalidate the Segment report
  2. Edit the DB to set the segment creation date and last edit date to the beginning date of the invalidation date range

For example:
Invalidate the report...
sudo -u apache -E bash -c "php /var/www/html/console core:invalidate-report-data --sites=IDSITE_HERE --segment='SEGMENT_NAME_DEFINITION_HERE' --dates=2023-01-01,2024-03-31 --matomo-domain=domain.matomo.cloud"

Log into the DB and update the segment table...
UPDATE segment SET ts_created = '2023-01-01 00:00:00', ts_last_edit = '2023-01-01 00:00:00' WHERE name LIKE 'SEGMENT_NAME';

This process should be automatic. When the core:invalidate-report-data command is used in combination with --segment, the system should check if the invalidation start date precedes the current ts_created and ts_last_edit dates in the segment table for the requested segment name. If it does, these columns should be modified automatically to remove the need to perform step two above.

@9joshua 9joshua added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. To Triage An issue awaiting triage by a Matomo core team member labels Apr 29, 2024
@sgiehl
Copy link
Member

sgiehl commented Apr 29, 2024

@9joshua This sound more like a workaround for processing segments beyond the configured time frame.

; When archiving segments for the first time, this determines the oldest date that will be archived.
; This option can be used to avoid archiving (for instance) the lastN years for every new segment.
; Valid option values include: "beginning_of_time" (start date of archiving will not be changed)
; "segment_last_edit_time" (start date of archiving will be the earliest last edit date found,
; if none is found, the created date is used)
; "segment_creation_time" (start date of archiving will be the creation date of the segment)
; editLastN where N is an integer (eg "editLast10" to archive for 10 days before the segment last edit date)
; lastN where N is an integer (eg "last10" to archive for 10 days before the segment creation date)
process_new_segments_from = "beginning_of_time"

If this is not set to "beginning of time", segments might not be processed for the past by default. Automatically updating the ts_created of a segment would bypass this setting. So we shouldn't do that.

@sgiehl sgiehl closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
@sgiehl sgiehl added answered For when a question was asked and we referred to forum or answered it. and removed To Triage An issue awaiting triage by a Matomo core team member labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

2 participants