diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-05-06 07:59:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 07:59:00 +0300 |
commit | 591ed0e5d4a8e3c7229270206bb4aab454fb0248 (patch) | |
tree | 11d453051508f70befdc114fd5edc7928588e2a9 | |
parent | e06590688c8751a889595e300fc49e2653215d91 (diff) |
Save profiling metadata (#15893)
Was needing this on production as otherwise I don't have any clue for what request the profile was created, for whom, and when. This helps better understand the profile and later reproduce the same issue etc.
-rw-r--r-- | core/Profiler.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/Profiler.php b/core/Profiler.php index 1e019733b2..20b297018f 100644 --- a/core/Profiler.php +++ b/core/Profiler.php @@ -270,6 +270,17 @@ class Profiler $outputDir . DIRECTORY_SEPARATOR . $runId . '.' . $profilerNamespace . '.xhprof', serialize($xhprofData) ); + $meta = array('time' => time(), 'instance' => SettingsPiwik::getPiwikInstanceId()); + if (!empty($_GET)) { + $meta['get'] = $_GET; + } + if (!empty($_POST)) { + $meta['post'] = $_POST; + } + file_put_contents( + $outputDir . DIRECTORY_SEPARATOR . $runId . '.' . $profilerNamespace . '.meta', + serialize($meta) + ); } if (empty($runId)) { |