-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Prevent error message in dev mode no date is defined in segment #17553
Conversation
Have been getting this notification many times every time I fetch a screen and always receive heaps of notifications (when dev mode enabled). This should fix it. > WARNING: Avoiding segment subquery due to missing start date and/or an end date. Please ensure a start date and/or end date is set when initializing a segment if it's used to build a query. Stacktrace: #0 /piwik/core/Segment.php(266): Piwik\Segment->doesSegmentNeedSubquery('!=', 'eventCategory') #1 /piwik/core/Segment.php(241): Piwik\Segment->getExpressionsWithUnionsResolved(Array) #2 /piwik/core/Segment.php(150): Piwik\Segment->initializeSegment('eventCategory!=...', Array) #3 /piwik/plugins/SegmentEditor/API.php(409): Piwik\Segment->__construct('eventCategory!=...', Array) #4 [internal function]: Piwik\Plugins\SegmentEditor\API->getAll('1') #5 /piwik/core/API/Proxy.php(244): call_user_func_array(Array, Array) #6 /piwik/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}() #7 /piwik/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure)) #8 /piwik/core/API/Request.php(266): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getAll', Array) #9 /piwik/core/API/Request.php(559): Piwik\API\Request->process() #10 /piwik/plugins/SegmentEditor/SegmentEditor.php(356): Piwik\API\Request::processRequest('SegmentEditor.g...', Array, Array) #11 /piwik/core/Segment.php(624): Piwik\Plugins\SegmentEditor\SegmentEditor::getAllSegmentsForSite(1) #12 /piwik/core/Archive/DataTableFactory.php(588): Piwik\Segment->getStoredSegmentName(1) #13 /piwik/core/Archive/DataTableFactory.php(288): Piwik\Archive\DataTableFactory->setPrettySegmentMetadata(Object(Piwik\DataTable)) #14 /piwik/core/Archive/DataTableFactory.php(259): Piwik\Archive\DataTableFactory->makeDataTableFromSingleBlob(Array, Array) #15 /piwik/core/Archive/DataTableFactory.php(375): Piwik\Archive\DataTableFactory->makeFromBlobRow(Array, Array) #16 /piwik/core/Archive/DataTableFactory.php(347): Piwik\Archive\DataTableFactory->createDataTable(Array, Array) #17 /piwik/core/Archive/DataTableFactory.php(188): Piwik\Archive\DataTableFactory->createDataTableMapFromIndex(Array, Array, Array) #18 /piwik/core/Archive/DataCollection.php(289): Piwik\Archive\DataTableFactory->make(Array, Array) #19 /piwik/core/Archive.php(386): Piwik\Archive\DataCollection->getExpandedDataTable(Array, NULL, NULL, false) #20 /piwik/core/ArchiveProcessor.php(346): Piwik\Archive->getDataTableExpanded('Goals_ItemsSku', NULL, NULL, false) #21 /piwik/core/ArchiveProcessor.php(213): Piwik\ArchiveProcessor->aggregateDataTableRecord('Goals_ItemsSku', NULL, NULL) #22 /piwik/plugins/Goals/Archiver.php(436): Piwik\ArchiveProcessor->aggregateDataTableRecords(Array, NULL, NULL, NULL, NULL, NULL, Array) #23 /piwik/core/Plugin/Archiver.php(103): Piwik\Plugins\Goals\Archiver->aggregateMultipleReports() #24 /piwik/core/ArchiveProcessor/PluginsArchiver.php(168): Piwik\Plugin\Archiver->callAggregateMultipleReports() #25 /piwik/core/ArchiveProcessor/Loader.php(228): Piwik\ArchiveProcessor\PluginsArchiver->callAggregateAllPlugins(2, 0, false) #26 /piwik/core/ArchiveProcessor/Loader.php(163): Piwik\ArchiveProcessor\Loader->prepareAllPluginsArchive(2, 0) #27 /piwik/core/ArchiveProcessor/Loader.php(101): Piwik\ArchiveProcessor\Loader->prepareArchiveImpl('Goals') #28 /piwik/core/Context.php(75): Piwik\ArchiveProcessor\Loader->Piwik\ArchiveProcessor\{closure}() #29 /piwik/core/ArchiveProcessor/Loader.php(105): Piwik\Context::changeIdSite(1, Object(Closure)) #30 /piwik/core/ArchiveProcessor.php(668): Piwik\ArchiveProcessor\Loader->prepareArchive('Goals') #31 /piwik/plugins/Goals/Archiver.php(485): Piwik\ArchiveProcessor->processDependentArchive('Goals', 'visitorType%3D%...') #32 /piwik/core/Plugin/Archiver.php(103): Piwik\Plugins\Goals\Archiver->aggregateMultipleReports() #33 /piwik/core/ArchiveProcessor/PluginsArchiver.php(168): Piwik\Plugin\Archiver->callAggregateMultipleReports() #34 /piwik/core/ArchiveProcessor/Loader.php(228): Piwik\ArchiveProcessor\PluginsArchiver->callAggregateAllPlugins(2, 0, false) #35 /piwik/core/ArchiveProcessor/Loader.php(163): Piwik\ArchiveProcessor\Loader->prepareAllPluginsArchive(2, 0) #36 /piwik/core/ArchiveProcessor/Loader.php(101): Piwik\ArchiveProcessor\Loader->prepareArchiveImpl('VisitsSummary') #37 /piwik/core/Context.php(75): Piwik\ArchiveProcessor\Loader->Piwik\ArchiveProcessor\{closure}() #38 /piwik/core/ArchiveProcessor/Loader.php(105): Piwik\Context::changeIdSite(1, Object(Closure)) #39 /piwik/plugins/CoreAdminHome/API.php(278): Piwik\ArchiveProcessor\Loader->prepareArchive('VisitsSummary') #40 /piwik/core/Archive.php(825): Piwik\Plugins\CoreAdminHome\API->archiveReports(1, Object(Piwik\Period\Week), '2021-05-10', '', 'VisitsSummary', NULL) #41 /piwik/core/Archive.php(624): Piwik\Archive->prepareArchive(Array, Object(Piwik\Site), Object(Piwik\Period\Week)) #42 /piwik/core/Archive.php(571): Piwik\Archive->cacheArchiveIdsAfterLaunching(Array, Array) #43 /piwik/core/Archive.php(497): Piwik\Archive->getArchiveIds(Array) #44 /piwik/core/Archive.php(312): Piwik\Archive->get(Array, 'numeric') #45 /piwik/core/ArchiveProcessor.php(606): Piwik\Archive->getDataTableFromNumeric(Array) #46 /piwik/core/ArchiveProcessor.php(252): Piwik\ArchiveProcessor->getAggregatedNumericMetrics(Array, false) #47 /piwik/core/ArchiveProcessor/PluginsArchiver.php(306): Piwik\ArchiveProcessor->aggregateNumericMetrics(Array) #48 /piwik/core/ArchiveProcessor/PluginsArchiver.php(104): Piwik\ArchiveProcessor\PluginsArchiver->aggregateMultipleVisitsMetrics() #49 /piwik/core/ArchiveProcessor/Loader.php(222): Piwik\ArchiveProcessor\PluginsArchiver->callAggregateCoreMetrics() #50 /piwik/core/ArchiveProcessor/Loader.php(163): Piwik\ArchiveProcessor\Loader->prepareAllPluginsArchive(6, 1) #51 /piwik/core/ArchiveProcessor/Loader.php(101): Piwik\ArchiveProcessor\Loader->prepareArchiveImpl('VisitsSummary') #52 /piwik/core/Context.php(75): Piwik\ArchiveProcessor\Loader->Piwik\ArchiveProcessor\{closure}() #53 /piwik/core/ArchiveProcessor/Loader.php(105): Piwik\Context::changeIdSite(1, Object(Closure)) #54 /piwik/plugins/CoreAdminHome/API.php(278): Piwik\ArchiveProcessor\Loader->prepareArchive('VisitsSummary') #55 /piwik/core/Archive.php(825): Piwik\Plugins\CoreAdminHome\API->archiveReports(1, Object(Piwik\Period\Month), '2021-05-01', '', 'VisitsSummary', NULL) #56 /piwik/core/Archive.php(624): Piwik\Archive->prepareArchive(Array, Object(Piwik\Site), Object(Piwik\Period\Month)) #57 /piwik/core/Archive.php(571): Piwik\Archive->cacheArchiveIdsAfterLaunching(Array, Array) #58 /piwik/core/Archive.php(497): Piwik\Archive->getArchiveIds(Array) #59 /piwik/core/Archive.php(312): Piwik\Archive->get(Array, 'numeric') #60 /piwik/plugins/VisitsSummary/API.php(36): Piwik\Archive->getDataTableFromNumeric(Array) #61 [internal function]: Piwik\Plugins\VisitsSummary\API->get('1', 'month', 'yesterday', false, Array) #62 /piwik/core/API/Proxy.php(244): call_user_func_array(Array, Array) #63 /piwik/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}() #64 /piwik/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure)) #65 /piwik/core/API/Request.php(266): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'get', Array) #66 /piwik/core/API/Request.php(559): Piwik\API\Request->process() #67 /piwik/plugins/CoreHome/Columns/UserId.php(119): Piwik\API\Request::processRequest('VisitsSummary.g...', Array, Array) #68 /piwik/plugins/CoreHome/Columns/UserId.php(104): Piwik\Plugins\CoreHome\Columns\UserId->isUsedInSite('1', 'month', 'yesterday') #69 /piwik/plugins/CoreHome/Columns/UserId.php(89): Piwik\Plugins\CoreHome\Columns\UserId->isUsedInSiteCached('1', 'month', 'yesterday') #70 /piwik/plugins/VisitsSummary/Reports/Get.php(181): Piwik\Plugins\CoreHome\Columns\UserId->isUsedInAtLeastOneSite(Array, 'month', 'yesterday') #71 /piwik/plugins/VisitsSummary/Reports/Get.php(87): Piwik\Plugins\VisitsSummary\Reports\Get->addSparklineColumns(Object(Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines)) #72 /piwik/core/Plugin/ViewDataTable.php(239): Piwik\Plugins\VisitsSummary\Reports\Get->configureView(Object(Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines)) #73 /piwik/core/ViewDataTable/Factory.php(243): Piwik\Plugin\ViewDataTable->__construct('get', 'VisitsSummary.g...', Array) #74 /piwik/core/ViewDataTable/Factory.php(156): Piwik\ViewDataTable\Factory::createViewDataTableInstance('Piwik\\Plugins\\C...', 'VisitsSummary.g...', 'VisitsSummary.g...', Array) #75 /piwik/core/Plugin/Report.php(318): Piwik\ViewDataTable\Factory::build('sparklines', 'VisitsSummary.g...', 'VisitsSummary.g...', 1) #76 /piwik/plugins/CoreHome/Controller.php(58): Piwik\Plugin\Report->render() #77 [internal function]: Piwik\Plugins\CoreHome\Controller->renderReportWidget(Object(Piwik\Plugins\VisitsSummary\Reports\Get)) #78 /piwik/core/FrontController.php(615): call_user_func_array(Array, Array) #79 /piwik/core/FrontController.php(167): Piwik\FrontController->doDispatch('VisitsSummary', 'get', Array) #80 /piwik/core/dispatch.php(32): Piwik\FrontController->dispatch() #81 /piwik/index.php(25): require_once('/Users/thomasst...') #82 {main} (Module: API, Action: get, Method: SegmentEditor.getAll, In CLI mode: false)
Code looks good, but I've seen this happen before, and I wonder if instead, we can move the segment parsing logic to another method that is called lazily. So if we just use getHash() the logic that needs startDate/endDate is never executed. |
that be better @diosmosis not sure how easy it is to do as I suppose currently it is maybe partially expected to throw an error if the segment doesn't exist or so (I think). I guess in the |
Looks like this worked |
Have been getting this notification many times every time I fetch a screen and always receive heaps of notifications (when dev mode enabled). This should fix it. Shouldn't be needed in the 4.3 release but selected 4.3 so it later gets converted maybe to 4.4
Review