Uncategorized

SharePoint 2010 Fun with Developer Dashboard

There number of new features added to SharePoint 2010 both Server and Foundation ( Windows SharePoint Services has been renamed to SharePoint foundation) , but being a dev at heart “Developer Dashboard” just steal the thunder at least when it comes to visual add on we get right inside the SharePoint Page. Lets first take a quick view what actually comprises of  “Developer Dashboard” (lets call it “DD” for short). I had divided the post into three sections , namely “See it ”  , “Configure it” and “Fun With It”

[All the screenshots , codes and command are subject to change in Beta 2 of SharePoint 2010]

 See it (Developer Dashboard)

Once enabled the “DD” can be seen on page as follows. (configuration is discussed later in the post)

img-1

The “DD”  can be viewed by clicking on a icon on top right pane , shown in red rectangle below. Actually it let you turn it off or on , just like a switch.

img-2 

Lets take a bit closer look of what actually comprises of “DD”

Developer Dashboard

img-7

Database Query

img-4

You can click on the Database Query to get more detail information on the query.For example following image show how the query looks like when youclick on “dbo.proc_getObjectsByBaseClass” link.

img-11

Web Server

img-5 

Web Part Events Offsets

img-6

There is a link  titled “Show or hide additional tracing information ..” which actually let you see complete trace , this can be extremely helpful in case you

want to drill down to complete details.

img-8 

Following is a screen capture of a part of information that you get (full screen capture is just too long to be posted)

img-9

img-10

Now lets see how to configure “DD”  ,such that its became available in the Farm.

Configure it (Developer Dashboard)

Configuration of “DD” can be done by using “stsadm” , “PowerShell” and via “API”. Actually first two options internally uses the API  but off course , its behind the scenes. 

Following Stsadm command can be used to configure “DD”, and there are actually three values that you can chose from [OnDeman|On|Off]. In most cases when you want to have the “DD” , you may want to use “OnDemand” as it let you have the ability to toggle it on a page, so bit of more flexibility.

image

image

image

PowerShell also provides the ability to configure “DD” . You can do it by first launching the “SharePoint  4.0 management Console” , from “Start” select “SharePoint 4.0 Management Console” (most likely this name will change in Beta 2 version), click “Run as Administrator” , see figure below.

image

Lets first check if SharePoint Farm is online , and then run the command (see figure below) . This is not mandatory but good to check first.

I  had changed the background color of Console to black , so don’t get surprise if yours is with blue background.

image 

Now its easy to do all these configuration using command line tools , like stsadm and PoweShell , but  what happen if you don’t have access to the server , and you want to do the setting from inside SharePoint 2010. There can be many solutions , you can write a feature that will  change setting for the “DD” , or you can have a custom  page (perhaps application level) that enable you to change the DD settings. In next section a simple feature is uses to configure the “DD” , simply by setting it to “OnDemand” when feature is activated , or to “Off” when feature is deactivated.

Fun With It

I have used Visual Studio 2010 (beta1) with Microsoft Visual Studio 2010 Beta Tools for SharePoint 2010, to develop the feature titled “DevDashBoard”. I will dig in complete code once beta 2 of SharePoint 2010 is available and things are more visible for everyone who is reading the post. Following is the main code fragment that basically do the real work.

So on “FeatureActivated” ,following code is executed

image

And on “FeatureDeactivating” simply the “SPPerformanceMonitoring” enum value is set to “Off” , as shown below

image

All three values [On|Off|OnDemand] can be seen in the “SPPerformanceMonitoing” as shown below

image 

After “DevDashBoardSwitch” is deployed it serves as switch to On/Off  the “DD” , as its become activated/deactivated.

image

Once activated the “OnDemand” behaviour of “DD” is available.

image

Once de-activated the  “DD”  will not be available or become “Off”.

 image

image

Advertisements