In my last post, I wrote about the mechanism within Team Foundation that records web method activity. You can mine the database to and learn much about how Team Foundation is being used. Recall that the web method information is written to a database so the full power of SQL queries is available.
List all Team Foundation activity
Combine the command and parameter table (the left join is necessary since some web method rows in the command table may not record parameter information -- more on this later)
select *from tbl_command cleft join tbl_parameter pon c.commandid = p.commandid
List all Team Foundation Version Control activity
Same as the previous query with the addition of filtering on the Application column (command table).
select *from tbl_command cleft join tbl_parameter pon c.commandid = p.commandid-- Just Version Control (other choices: Data Warehouse, Integration, Work Item Tracking, Proxy)where c.Application = 'Version Control'
Show the web methods with the longest execution time
The ExecutionTime column contains the execution time, in microseconds, of the web method.
select *from tbl_command cleft join tbl_parameter pon c.commandid = p.commandidorder by c.ExecutionTime desc
Show the web methods called the most
select command, count (command) as TimesCalledfrom tbl_command cgroup by commandorder by TimesCalled desc
Show the web method calls made by userN
The IdentityName column contains the Windows account name of the caller.
select *from tbl_command cleft join tbl_parameter pon c.commandid = p.commandid-- IdentityName contains the account name of the user (domain\account)where c.IdentityName like '%userN%'
Show the web method calls made from Visual Studio
The UserAgent column contains the name of the executable from which the web method call originates.
select *from tbl_command cleft join tbl_parameter pon c.commandid = p.commandid-- UserAgent contains the executable namewhere c.Useragent like '%devenv.exe%'
Other tidbits