4

I'm trying to setup Xhgui with Xhprof. I followed the github instructions (https://github.com/perftools/xhgui), but this error message keeps appearing in error logs :

"xhgui - document to insert contains invalid key: keys cannot contain ".": "main()==>load..."

Looks like mongoDB can't use dots in keys, but yet Xhgui is trying to do that.

Is there a way do disable this limitation in mongoDB ? Or to fix this bug in Xhgui ?

FLX
  • 2,626
  • 4
  • 26
  • 57

1 Answers1

3

https://github.com/perftools/xhgui/issues/209#issuecomment-339281276

For anyone experiencing this issue, I was able to make it work by adding the following snippet of code to xhgui/external/header.php right before ignore_user_abort(true); call. Not sure how correct is this and if it could affect anything else, but it did the trick for me.

    $profile = [];
    foreach($data['profile'] as $key => $value) {
        $profile[strtr($key, ['.' => '_'])] = $value;
    }
    $data['profile'] = $profile;
Roberto Bisello
  • 1,235
  • 10
  • 18
Volodymyr
  • 490
  • 5
  • 9
  • thanks! in the version I am using as of Jan 2020, this snippet now goes into the file: xhgui/vendor/perftools/xhgui-collector/external/header.php – Matt Jan 03 '20 at 21:08