Welcome to a new era of server side diagnostics with Sitecore. In the past we had the following tools to help us identify performance issues with our Sitecore installations:
These tools could be used in circumstances where it is not possible to attach a debugger or application profiler like the ANTS Performance Profiler to a running web application. No there it’s time to add a new tool to this list, that tool is Glimpse.
What is Glimpse and why should I care
Glimpse is an awesome server debugging tool that runs right out of your browser.
I once heard it described as ‘doing for the server development what Firebug does for front end development’. It unobtrusively instruments requests to your web application, exposing server side configuration and performance information right inside your browser, looking and behaving just like the Chrome Developer Tools. If you want to get a better idea of what problems Glimpse sets out to address take a look at Anthony van der Horn’s presentation Web diagnostics with a Glimpse in ASP.NET.
A Sitecore Glimpse Plugin, hell Yes
Not to be left out of all of this browser goodness David Morrison created a Glimpse plugin that integrates with Sitecore. If you want to find out more about the Sitecore Plugin for Glimpse be sure to check out David’s Virtual User Group presentation.
To use this plugin you will need to:
- Install the Sitecore Glimpse NuGet Package
PM> Install-Package Sitecore.GlimpsePlugins.SitecoreContext
Attempting to resolve dependency 'Glimpse (≥ 0.87)'.
Installing 'Glimpse 0.87'.
Successfully installed 'Glimpse 0.87'.
Installing 'Sitecore.GlimpsePlugins.SitecoreContext 188.8.131.52'.
Successfully installed 'Sitecore.GlimpsePlugins.SitecoreContext 184.108.40.206'.
Adding 'Glimpse 0.87' to Website.
Successfully added 'Glimpse 0.87' to Website.
Adding 'Sitecore.GlimpsePlugins.SitecoreContext 220.127.116.11' to Website.
Successfully added 'Sitecore.GlimpsePlugins.SitecoreContext 18.104.22.168' to Website.
- Fix the Web Configuration Error Attempting to run the web site after installing the package will reward you with the following error message from IIS:
The issue here is that the web.config transform that ships with the Glimpse package adds a trace element to the configuration. To fix this, edit the web.config file and merge the attributes of the two trace elements so that you end up with something along these lines.
<trace writeToDiagnosticsTrace="true" enabled="true" requestLimit="50" pageOutput="false" traceMode="SortByTime" localOnly="true" />
You are now in a position where you can take advantage of the advanced web diagnostics that Glimpse will provide. Navigate to Glimpse.axd on your website and enable Glimpse, a cookie will be set to remember this setting.
Now every time that you request a page a Glimpse icon will appear in the bottom right of your browser window. Click on this and you will be shown a panel with the information gathered for the request. There is a Sitecore tab which holds all of the information relating to how Sitecore processed your request.
If this is all you need you can stop reading now and start being more productive with Sitecore web diagnostics.
I have recently created a new project on GitHub to house a parallel development of a Glimpse plugin for Sitecore. Rather than simply fork Davids original work this project starts afresh and aims to:
- utilise the latest Glimpse packages to deliver up to date features like the Glimpse Heads-Up Display (HUD)
- incorporate unit tests from the outset
- provide build scripts that automate the tasks of compiling, testing and packaging the project artifacts to make it easier to open the project up for collaborative development
- develop the plugin further to surface even more Sitecore information via Glimpse
This project is very much in its infancy and in it’s current form is based heavily around Davids original codebase. I have a long list of features that I would like to add to the project and will create a Trello board to organise these ideas in the very near future. At some stage this work may get migrated back into the original Sitecore.GlimpsePlugins.SitecoreContext project or it may remain a standalone development. In the meantime I would be very pleased to hear any ideas for features or enhancements that you might have and welcome collaboration on the development of the project.