diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-09-11 04:36:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 04:36:09 +0300 |
commit | b8e4d27f2151103df826e5dd643b433cdde05aaf (patch) | |
tree | b01853ecfd5ed05be679ed7e19bdc7956c64009d /plugins | |
parent | 13aad03773d4576188ebd2db7971337ad4edca4f (diff) |
Couple changes to aid debugging (#13269)
* Add ability to print arguments in fatal error trace.
* Add sum of blob content to analyze archive tables command.
* Fixing tests.
* Fixing tests.
* fixing test
* json_encode instead of strval
* fix test
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Diagnostics/Commands/AnalyzeArchiveTable.php | 10 | ||||
-rw-r--r-- | plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php | 77 |
2 files changed, 48 insertions, 39 deletions
diff --git a/plugins/Diagnostics/Commands/AnalyzeArchiveTable.php b/plugins/Diagnostics/Commands/AnalyzeArchiveTable.php index 915019ce46..c579de3928 100644 --- a/plugins/Diagnostics/Commands/AnalyzeArchiveTable.php +++ b/plugins/Diagnostics/Commands/AnalyzeArchiveTable.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\Diagnostics\Commands; use Piwik\Container\StaticContainer; +use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Plugin\ConsoleCommand; use Symfony\Component\Console\Input\InputArgument; @@ -50,7 +51,7 @@ class AnalyzeArchiveTable extends ConsoleCommand } $headers = array('Group', '# Archives', '# Invalidated', '# Temporary', '# Error', '# Segment', - '# Numeric Rows', '# Blob Rows'); + '# Numeric Rows', '# Blob Rows', '# Blob Data'); // display all rows $table = new Table($output); @@ -63,20 +64,27 @@ class AnalyzeArchiveTable extends ConsoleCommand $totalTemporary = 0; $totalError = 0; $totalSegment = 0; + $totalBlobLength = 0; foreach ($rows as $row) { $totalArchives += $row['count_archives']; $totalInvalidated += $row['count_invalidated_archives']; $totalTemporary += $row['count_temporary_archives']; $totalError += $row['count_error_archives']; $totalSegment += $row['count_segment_archives']; + if (isset($row['sum_blob_length'])) { + $totalBlobLength += $row['sum_blob_length']; + } } + $formatter = new Formatter(); + $output->writeln(""); $output->writeln("Total # Archives: <comment>$totalArchives</comment>"); $output->writeln("Total # Invalidated Archives: <comment>$totalInvalidated</comment>"); $output->writeln("Total # Temporary Archives: <comment>$totalTemporary</comment>"); $output->writeln("Total # Error Archives: <comment>$totalError</comment>"); $output->writeln("Total # Segment Archives: <comment>$totalSegment</comment>"); + $output->writeln("Total Size of Blobs: <comment>" . $formatter->getPrettySizeFromBytes($totalBlobLength) . "</comment>"); $output->writeln(""); } } diff --git a/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php b/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php index 75a3bf67bd..85752b2c68 100644 --- a/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php +++ b/plugins/Diagnostics/tests/Integration/Commands/AnalyzeArchiveTableTest.php @@ -38,50 +38,51 @@ class AnalyzeArchiveTableTest extends ConsoleCommandTestCase $expected = <<<OUTPUT Statistics for the archive_numeric_2010_03 and archive_blob_2010_03 tables: -+-------------------------------------------+------------+---------------+-------------+---------+-----------+----------------+-------------+ -| Group | # Archives | # Invalidated | # Temporary | # Error | # Segment | # Numeric Rows | # Blob Rows | -+-------------------------------------------+------------+---------------+-------------+---------+-----------+----------------+-------------+ -| week[2010-03-01 - 2010-03-07] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 36 | 65 | -| month[2010-03-01 - 2010-03-31] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 36 | 65 | -| day[2010-03-03 - 2010-03-03] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-04 - 2010-03-04] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-05 - 2010-03-05] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-06 - 2010-03-06] idSite = 1 | 7 | 0 | 0 | 0 | 6 | 60 | 73 | -| day[2010-03-07 - 2010-03-07] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-08 - 2010-03-08] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| week[2010-03-08 - 2010-03-14] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-09 - 2010-03-09] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-10 - 2010-03-10] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-11 - 2010-03-11] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-12 - 2010-03-12] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-13 - 2010-03-13] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-14 - 2010-03-14] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-15 - 2010-03-15] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| week[2010-03-15 - 2010-03-21] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-16 - 2010-03-16] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-17 - 2010-03-17] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-18 - 2010-03-18] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-19 - 2010-03-19] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-20 - 2010-03-20] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-21 - 2010-03-21] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-22 - 2010-03-22] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| week[2010-03-22 - 2010-03-28] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-23 - 2010-03-23] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-24 - 2010-03-24] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-25 - 2010-03-25] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-26 - 2010-03-26] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-27 - 2010-03-27] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-28 - 2010-03-28] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-29 - 2010-03-29] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-30 - 2010-03-30] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -| day[2010-03-31 - 2010-03-31] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | -+-------------------------------------------+------------+---------------+-------------+---------+-----------+----------------+-------------+ ++-------------------------------------------+------------+---------------+-------------+---------+-----------+----------------+-------------+-------------+ +| Group | # Archives | # Invalidated | # Temporary | # Error | # Segment | # Numeric Rows | # Blob Rows | # Blob Data | ++-------------------------------------------+------------+---------------+-------------+---------+-----------+----------------+-------------+-------------+ +| week[2010-03-01 - 2010-03-07] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 36 | 65 | 6793 | +| month[2010-03-01 - 2010-03-31] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 36 | 65 | 6793 | +| day[2010-03-03 - 2010-03-03] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-04 - 2010-03-04] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-05 - 2010-03-05] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-06 - 2010-03-06] idSite = 1 | 7 | 0 | 0 | 0 | 6 | 60 | 73 | 8140 | +| day[2010-03-07 - 2010-03-07] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-08 - 2010-03-08] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| week[2010-03-08 - 2010-03-14] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-09 - 2010-03-09] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-10 - 2010-03-10] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-11 - 2010-03-11] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-12 - 2010-03-12] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-13 - 2010-03-13] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-14 - 2010-03-14] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-15 - 2010-03-15] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| week[2010-03-15 - 2010-03-21] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-16 - 2010-03-16] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-17 - 2010-03-17] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-18 - 2010-03-18] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-19 - 2010-03-19] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-20 - 2010-03-20] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-21 - 2010-03-21] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-22 - 2010-03-22] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| week[2010-03-22 - 2010-03-28] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-23 - 2010-03-23] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-24 - 2010-03-24] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-25 - 2010-03-25] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-26 - 2010-03-26] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-27 - 2010-03-27] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-28 - 2010-03-28] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-29 - 2010-03-29] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-30 - 2010-03-30] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | +| day[2010-03-31 - 2010-03-31] idSite = 1 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | | ++-------------------------------------------+------------+---------------+-------------+---------+-----------+----------------+-------------+-------------+ Total # Archives: 106 Total # Invalidated Archives: 0 Total # Temporary Archives: 0 Total # Error Archives: 0 Total # Segment Archives: 72 +Total Size of Blobs: 21.2 K OUTPUT; |