Jump to content

Tracy Debugger


adrian

Recommended Posts

Thanks again for all that. The one that stands out is the ToDo panel - I honestly haven't tested that on a large site with many template php/css/js files, so perhaps that is expected. Maybe I need to implement some caching so that it only scans files if they have been changed since the last scan. That should help with that significantly. Actually, you should take a look at the ToDo panel config settings and exclude any js/css from external libraries - I bet that is what is slowing that down. My ToDo panel renders in 0.03s compared to your 1.27s!

I was actually thinking about adding caching to the Validator panel as well although that one will be a little more complex as it will require storing the rendered HTML so it can be compared.

Regarding the generally slow nature of your local dev setup - have you read this thread: 

I feel like it might be the reason Tracy is running so slow - would be worth a look regardless as it seems like you are experiencing slow page loads even without Tracy, although of course I don't know what resources your page is loading.

 

  • Like 1
Link to comment
Share on other sites

Just added color significance to PW and Tracy Log panel icons.

  • Red for errors, exception, critical
  • Orange for everything else, including warnings, info, debug, and any custom names PW logs
  • Green for none

All colors are based on log entries from the last 5 seconds which should cover everything loaded/redirected etc during the last page load. The idea being that you don't want the red or orange colors to be triggered from an error that was recorded days ago, even if it's the most recent entry. 

Hopefully this logic makes sense and it provides a useful visual cue to let you know that something was just logged.

PS - as part of this I needed a different icon for the Tracy log panel - you'll see it's now burning campfire logs - it's actually hard to find a nice small icon for logs :)

  • Like 2
Link to comment
Share on other sites

hi adrian,

thank you for that link. i tried all that but without success. if i open LICENCE.TXT it loads really fast. don't know what the problem is, but it's getting offtopic and i have to finish my project :)

thank you for all your help.

Link to comment
Share on other sites

I think an on-demand google pagespeed and gtmetrix page analyzis could be nice panel additions. On "on-demand" I mean they should analyze only on user request (eg. click on a button). Both have APIs but PS requires an api key, maybe gtmetrix too.

I know it's a bigger request, I'm just asking whether you have thought about such feature.

  • Like 5
Link to comment
Share on other sites

11 hours ago, tpr said:

I think an on-demand google pagespeed and gtmetrix page analyzis could be nice panel additions. On "on-demand" I mean they should analyze only on user request (eg. click on a button). Both have APIs but PS requires an api key, maybe gtmetrix too.

I know it's a bigger request, I'm just asking whether you have thought about such feature.

I think it's a great idea - I have added to my list. 

 

7 hours ago, bernhard said:

at least for google it would be as easy as adding a link like this


echo '<a href="https://developers.google.com/speed/pagespeed/insights/?url=' . $page->httpUrl . '">Google Speedtest</a>';

 

 

In the meantime I have added a new "Custom PHP" panel which lets you return anything you want.

Screen Shot 2016-07-27 at 11.46.39 AM.png

which results in:

Screen Shot 2016-07-27 at 11.47.29 AM.png

Not very pretty looking I know - I am sure @tpr will have some style suggestions for me :)

This is obviously not the best solution for things like page speed because it won't work with local dev sites, so as I said, I will work on dedicated panels for those, but this still may be helpful until then, and perhaps also for other things.

Some other significant recent updates that I haven't mentioned.

  • There are now separate default panel config options for frontend vs backend
  • The User switcher now lets you logout (while maintaining the session and access to the Tracy debug bar). Until recently, you had to switch to a different user before the logout would work properly.
  • Like 5
Link to comment
Share on other sites

Second new panel today :)

Introducing "Page Recorder"

Screen Shot 2016-07-27 at 6.41.25 PM.png

This panel records the ID of all pages added whenever it is enabled (so this is one you'll want off by default and just enabled via "Sticky" when you need it).

This is perfect for all sorts of testing, whether you need to create a LOT of pages for performance testing or you are testing a form which is automatically creating pages. Once you are done with the testing session, simply click the "Trash Recorded Pages" button and they will all be moved to the Trash.

Because pages are sent to the trash rather than completely deleted, I consider it safe to use, but I am a little worried that someone may leave it enabled when they are creating real content pages and then later trash them, then empty the trash without realizing it contains a page they want. If there is demand, I may consider adding checkboxes so you can remove certain pages from the list so they won't get trashed with all the others.

Please let me know if you have any suggestions for functionality or the interface.

  • Like 4
Link to comment
Share on other sites

hi adrian,

the page recorder reminded me of my hook recorder i created almost a year ago and i got very little feedback so didn't take it further (not to say it was and may still be beyond my scope ;) ). i think it could play very well together with tracy and all the options we have now (eg only load that panel once when needed).

that's only a first vague idea. the last post in the topic has some more suggestions. if you like the idea i would be happy to support you as much as i can :)

  • Like 4
Link to comment
Share on other sites

The custom php module works great for google speed test. I added a no-jquery javascript lightbox to it (modified version of squeral lightbox), called from my site js.

tracy-pagespeed-lightbox.gif

The same could be added for gtmetrix but even using "?url=xxx" needs manual click on the "Analyize" button (the url is pre-filled though).

I can share the code if someone needs. 

  • Like 5
Link to comment
Share on other sites

Hi there,

I've just been fighting a very basic issue on my localhost. Some code that did a simple redirect just stopped working. The redirect ignored the path and just ended up at the site root URL. Because I had changed numerous things, I almost tore the application apart trying to work out what was going wrong with this very simple command:

$session->redirect($utils->stripDoubleSlashes("$rootUrl$successMessage"));

One other thing I had done was installed the Tracy module. I unticked "Enable Tracy Debugger" and the $session->redirect started to work again just fine. I then hard-coded the redirect path and put it on the first line of my home.php template and turned Tracy back on again:

$session->redirect('http://localhost:8888/contact/thank-you/');

I just ended up back at the root of localhost with a blank page.

Any ideas what might be happening here?

Thanks! :)

 

Link to comment
Share on other sites

Just for the record, this works for gtmetrix (opens in new window):

return '<form action="https://gtmetrix.com/analyze.html" method="post" target="_blank">' . 
   '<input type="hidden" name="url" value="' . $page->httpUrl . '" />' . 
   '<button type="submit">GTmetrix test</button>' . 
'</form>';

I managed to make it work in iframe but it's kinda hacky, I think it's better open it like this.

  • Like 3
Link to comment
Share on other sites

Hej,

I was playing around with Tracy Debugger and when I checked the Page/Template/Fields Object options for the Processwire-Info panel I only get a blank page rendered in the processwire backend. ... !?
Using MAMP.

Any ideas what is going on?

cheers,
Steffen

Link to comment
Share on other sites

25 minutes ago, tpr said:

Just for the record, this works for gtmetrix (opens in new window):


return '<form action="https://gtmetrix.com/analyze.html" method="post" target="_blank">' . 
   '<input type="hidden" name="url" value="' . $page->httpUrl . '" />' . 
   '<button type="submit">GTmetrix test</button>' . 
'</form>';

I managed to make it work in iframe but it's kinda hacky, I think it's better open it like this.

would be good to have such snippets available somewhere (github or the like). maybe a dedicated folder where we can add files and make pull requests?

13 minutes ago, blynx said:

Hej,

I was playing around with Tracy Debugger and when I checked the Page/Template/Fields Object options for the Processwire-Info panel I only get a blank page rendered in the processwire backend. ... !?
Using MAMP.

Any ideas what is going on?

cheers,
Steffen

are you using the latest version of tracy?

Link to comment
Share on other sites

18 minutes ago, bernhard said:

would be good to have such snippets available somewhere (github or the like). maybe a dedicated folder where we can add files and make pull requests?

Maybe they could be in the module docs.

Link to comment
Share on other sites

47 minutes ago, bernhard said:

are you using the latest version of tracy?

@bernhard  yep, latest version of the TracyDebugger module, just installed it. But I was using ProcessWire 2.7.2 - Was trying with ProcessWire 3.0.11 now:
Same problem but it only occurs once when I log in. After a reload the backened page loads as it should. ... For a couple of times. Now can't log into PW3 either - blank screen.
Will have a try on a Webserver later ... Maybe it is something about the MAMP configuration?

EDIT: No errors in apache_error.log or php_error.log in Apps/MAMP/logs/...

Link to comment
Share on other sites

1 hour ago, blynx said:

I was playing around with Tracy Debugger and when I checked the Page/Template/Fields Object options for the Processwire-Info panel I only get a blank page rendered in the processwire backend. ... !?
Using MAMP.

Any ideas what is going on?

Does it make a difference if you only have one of those Object options enabled - trying to figure out if it's one in particular or whether it's the size of the content when more than one is checked.

Also, did you make any changes to the Maximum Nesting Depth option? If that is too high, those Objects could get very large.

Link to comment
Share on other sites

@blynx - it just occurred to me - I think the problem may also be related to SessionHandlerDB - do you have that module installed? If so, there are two things possibly going on. 

Of course you can also just uninstall the SessionHandlerDB module as well, assuming I am correct that this is the problem :)

 

 

Link to comment
Share on other sites

5 hours ago, Gazley said:

Hi there,

I've just been fighting a very basic issue on my localhost. Some code that did a simple redirect just stopped working. The redirect ignored the path and just ended up at the site root URL. Because I had changed numerous things, I almost tore the application apart trying to work out what was going wrong with this very simple command:


$session->redirect($utils->stripDoubleSlashes("$rootUrl$successMessage"));

One other thing I had done was installed the Tracy module. I unticked "Enable Tracy Debugger" and the $session->redirect started to work again just fine. I then hard-coded the redirect path and put it on the first line of my home.php template and turned Tracy back on again:


$session->redirect('http://localhost:8888/contact/thank-you/');

I just ended up back at the root of localhost with a blank page.

Any ideas what might be happening here?

Thanks! :)

 

Hi @Gazley,

I am sorry this has been a painful debugging experience for you!

I am trying to reproduce here without any luck. Are you running the Master version of the Tracy core, or the Legacy version? Does it help if you switch?

Also, does the same problem occur with all custom panels removed? Use the Panel Selector Sticky option to quickly test without any panels enabled - if this helps, could you narrow it down to a specific panel for me?

If none of that helps, could you send me all the code for your home.php file (and any other files that are included in it)?

Link to comment
Share on other sites

@tpr and @bernhard - thanks for your thoughts on the Custom PHP panel - the form for submitting to gtmetrix is cool.

I am happy to provide a place for sharing these snippets - let's see just how many get posted here for the moment and if we get a critical mass, then I'll either add them to the blog post, or start a Github repo.

Let me take a better look at your Hook Recorder - it definitely sounds interesting!

  • Like 2
Link to comment
Share on other sites

@adrian

I updated the version to latest and unset all the panels as you suggested, with no difference. I've posted my home.php code below.

I am also using @wanze's TemplateEngineTwig module.

<?php

namespace ProcessWire;

// FileCompiler=0

// Line below added to test Tracy issue
$session->redirect('http://localhost:8888/contact/thank-you/');

$forms->addHookAfter('FormBuilderProcessor::saveForm', function(HookEvent $event) {

    $form = $event->object;

    if ($form->formName === 'contact') {

        $session = wire('session');

        if ($packageValue = wire('input')->post['package']) {

            $formMessage = $packageValue;
            $session->set('form-message', $formMessage);

        }

        $rootUrl = SITE_URL;
        $successMessage = $form->successMessage;
        $utils = wire('modules')->get('Utils');
        $session->redirect($utils->stripDoubleSlashes("$rootUrl$successMessage"));

    }

});

$config->forms += ['form' => $forms->render('contact')];

foreach ($page->page_matrix as $item) {

    $view->set($item->output_variable, $item->render());

}

 

Link to comment
Share on other sites

  • adrian pinned and locked this topic
  • adrian unpinned and pinned this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...