Advanced configuration options

From ShowSlow
Jump to: navigation, search

Configuration settings below are optional and defaults in the system are reasonable.

Basic configuration is enough to get started, but if you want to tweak your instance to your liking, we try to make things quite flexible - go ahead and get crazy with switches ;)

Contents

Running WebPageTest tests

Starting from version 0.6, you can now run tests using WebPageTest directly from details page.

You can configure this integration using following variables:

$webPageTestKey = '....';
$webPageTestBase = 'http://www.webpagetest.org/';
$webPageTestPrivateByDefault = false;
$webPageTestFirstRunOnlyByDefault = false;

All non-private results will be stored in database and listed at the bottom of the details pages. If you'd like to store private results as well, add this variable to config.php:

$keepPrivatePageTests = true;

API key

You must set an API key ($webPageTestKey). For the public instance of WebPageTest, you have to request it from Patrick Meenan.

If your private instance does not require a key, then just set it to some non-null value.

Commenting out $webPageTestKey definition (or setting it to null) will disable integration between the tools.

Custom metrics

For each custom metric you want to track, copy this block of code into config.php:

$metrics['bouncerate'] = array(
       'id' => 1,
       'title' => 'Bounce Rate (in %)',
       'color' => 'purple',
       'description' => 'Bounce rate measured by Google Analytics',
       'min' => 0,
       'max' => 100
);

YSlow profiles

Change it if you want to allow other profiles including your custom profiles

$YSlow2AllowedProfiles = array('ydefault');

Grouping URLs

You can group URLs to be displayed on URLs measured tab if you need to provide easy access to users for a subset of URLs.

You need to add entries like the following to the $URLGroups array in config file:

$URLGroups['showslow'] = array(
	'title' => "ShowSlow.com pages",
	'urls' => array(
		'http://www.showslow.com/'
	)
);
$URLGroups['sergeycheblog'] = array(
	'title' => "Sergey's blog",
	'urls' => array(
		'http://www.sergeychernyshev.com/blog/'
	)
);

URL prefixes provided will be used to filter the listing when link is clicked.

Limit URLs accepted

$limitURLs = array( 'http://www.yahoo.com/', 'http://www.google.com/' );

If is not false, then should be an array of prefix matches or PCRE regular expressions - if one of them matches, URL will be accepted.

Ignore URLs

By default Show Slow ignores URLs from private networks, but if you're testing some internal servers, you can remove some of these.

$ignoreURLs = array(
        'http://127.0.0.',
        'http://localhost/',
        'http://localhost:',
        'http://10.',
        'http://192.168.',
        'http://172.16.',
        'http://172.17.',
        'http://172.18.',
        'http://172.19.',
        'http://172.20.',
        'http://172.21.',
        'http://172.22.',
        'http://172.23.',
        'http://172.24.',
        'http://172.25.',
        'http://172.26.',
        'http://172.27.',
        'http://172.28.',
        'http://172.29.',
        'http://172.30.',
        'http://172.31.'
);

It's probably not a very good idea to remove 127.0.0.x simply because it can confuse the automation scripts when they'll be ordered to crawl local machine.

Drop query strings from URLs

You can configure ShowSlow to ignore query strings.

You can configure it for all URLs:

$dropQueryStrings = true;

or only for those matching one of the prefixes:

$dropQueryStrings = array( 'http://www.yahoo.com/', 'http://www.google.com/' );

Custom lists of URLs

You can create a group of URLs you want to be displayed on a separate page.

$customLists['alexa'] = array(
        'title' => 'Alexa Top 100',
        'description' => 'Most popular sites of the internet accorting to <a href="" target="_blank">Alexa Top 100</a>.',
        'hidden' => false,
        'urls' => array(
                "<nowiki>http://www.google.com/</nowiki>",
                "<nowiki>http://www.facebook.com/</nowiki>",
                "<nowiki>http://www.youtube.com/</nowiki>",
                "<nowiki>http://www.yahoo.com/</nowiki>",
                ...
        )
);

List will be automatically added to the menu, unless hidden attribute is set to true.

Custom timeplot instance location

If you're hosting SIMILE Timeplot library yourself, then you have to set this to the base URL.

$TimePlotBase = '/timeplot/';

Google Analytics

To see if your users are visiting the tool, enable Google Analytics (for publicly hosted instances).

$googleAnalyticsProfile = '';

ShowSlow feedback

If you'd like to show feedback button for ShowSlow project so your users can suggest new features or report bugs in ShowSlow, you can enable this button.

$showFeedbackButton = true;

Deleting old data

How old should data be for deletion (in days). Anything >0 will delete old data. Don't forget to add a cron job to run deleteolddata.php

$oldDataInterval = 60;

HAR support

ShowSlow now supports HAR beacon that can be used either manually or with a simple script that posts HAR file as a POST body. More importantly, beacons support is also added to Firebug's NetExport extension that allows saving complete contents of Net panel into a file, in this case, it'll send it to the server (by default it is configured to send to http://www.showslow.com/beacon/har/, but you can change configuration in about:config).

To enable HAR beacon, set

$enableHARBeacon = true;

You can also install HAR Viewer locally and set $HARViewerBase to point at it's location.

HAR processors

ShowSlow can process submitted HAR files. To add your own processor, you have to add a callable object to $HAR_processors array.

This callable will be called each time payload is submitted to HAR beacon. First parameter is $url_id and second parameter is $har payload.

# Example of HAR processor that calculates a custom metric (total blocking time) and records it
$metrics['blocked'] = array(
        'id' => 25,
        'title' => 'Total blocking time (in milliseconds)',
        'color' => 'grey',
        'description' => 'Total blocking time extracted from HAR',
        'min' => 0,
        'type' => MS
);

$HAR_processors[] = function($url_id, $har) {
        $blocked = 0;

        if (array_key_exists('log', $har) && array_key_exists('entries', $har['log'])) {
                foreach($har['log']['entries'] as $entry) {
                        $entries ++;

                        if (array_key_exists('timings', $entry) && array_key_exists('blocked', $entry['timings'])) {
                                if ($entry['timings']['blocked'] > 0) {
                                        $blocked += $entry['timings']['blocked'];
                                }
                        }
                }
        }

        $query = sprintf("INSERT INTO metric (url_id, metric_id, value) VALUES ('%d', '%d', '%f')",
                mysql_real_escape_string($url_id),
                mysql_real_escape_string(25),
                mysql_real_escape_string($blocked)
        );

        if (!mysql_query($query))
        {
                beaconError(mysql_error());
        }
};

Compare rankings

ShowSlow can compare YSlow and PageSpeed rankings over time for different URLs - you can see comparison page linked from Compare rankings tab on the home page.

You can optionally configure a list of URLs to compare by default when this tab is clicked - just set $defaultURLsToCompare to an array of URLs and this page will show the graph (granted that data for those URLs is collected).

Example:

$defaultURLsToCompare = array('http://www.google.com/', 'http://www.yahoo.com/', 'http://www.amazon.com/');

Graph smoothing

Only applies to Timeplot graphs

Graphs in ShowSlow are smoothed to avoid constant jumping back and forth for sites that have dynamic features and vary pages from test to test.

To configure the size of the sample for smoothing, you can tweak $smoothDistance variable:

$smoothDistance = 5;

Caching for static assets using SVN Assets

TODO: update when new asset version tool is implemented

ShowSlow is very serious about its own performance and all bugs in the system related to performance get high priority as minimum.

Starting with version 0.6, it uses SVN Assets library to enable asset caching.

By default root URL for static assets is the same as Show Slow base URL, but if you use different base hostname mapping for your static "CDN", you can configure SVN Assets by setting $baseAssetURL variable. You might also need to enable mod_rewrite, mod_expires and mod_deflate apache modules in order for it to work.

Allowing users to enter their URLs for monitoring

This variable enables user registrationa and adds "+add URL" tab to navigation

$enableMyURLs = true;

Beacon details

For beacons that support details (e.g. yslow), you can disable gathering of that information on a beacon end (it is enabled by default):

$keepBeaconDetails = false;

Keeping only newest details for YSlow

You can configure ShowSlow to erase details for all old beacons for each URL (disabled by default). This will happen when new beacon is recorded (granted that $keepBeaconDetails is set to true):

$cleanOldYSlowBeaconDetails = true;

Beacon keys

You can limit beacon access beacon access by setting up beacon keys.

$beaconKeys['yslow'] = "<key>";
$beaconKeys['pagespeed'] = array("<key1>", "<key2>");

For simplicity, array is keyed off of folder name for the beacon, e.g. yslow, pagespeed, webpagetest and so on.

Value can be either a single key as a string or an array of strings for multiple keys.

Beacon configuration

Beacons themselves must be configured to send the keys as a query string parameter:

http://your.server/base/showslow/beacons/<beacon>/?key=<key>&the=rest&of=params

Query string work-around

Unfortunately, some tools just set the query string to their data and only work with base path, in this case you can use path info work-around:

http://your.server/base/showslow/beacons/<beacon>/index.php/<key>/?the=rest&of=params

Calling custom code when new URL is added

You can define your own code to be executed when new URL is added for monitoring by one of the users.

First parameter is a URL that was passed and second parameter is Startup API user object for user who added the URL.

$onNewMonitoredURL = function($url, $user) {
       // do you stuff
}
Personal tools