共用方式為


Team Foundation: What's my server doing?

We designed a mechanism to record web method activity for all of the Team Foundation web applications. Information about each web method invocation is recorded in a single database.

We don't provide any ways to get to that data -- however, if you have access to the data tier you can write a few SQL queries to see what your Team Foundation web applications are doing.

Web method logging is controlled by a setting in each web application's web.config file. The default configuration disables web method logging but it's pretty simple to enable it.

Locate each web.config file under the installation directory, i.e., D:\Program Files\Microsoft Visual Studio 2005 Enterprise Server.

In the <appSettings> section you should see something like the following:

     <!-- WEB METHOD LOGGING
Specify whether web methods are to be logged always, never, or only
when errors occurs. Without a value for commandLogging, web methods
are not logged. Valid values are:
None (web methods are never logged)
Normal (log everything, except certain high-frequency web methods)
All (log everything, even certain high-frequency web methods)
OnError (only log web methods that have errors)

              Values specified here take precedence over values set administratively via
web method.
-->
<add key="commandLogging" value="None"/>

Change None to Normal or All and web method activity will now be recorded.

I'll go into the details of how we collect and record the data if enough people are interested. Note that the data is spooled for a short while before it's written to the database.

The database (for now, it's will be renamed) is called VSTEAMSCCAdmin. There are some historical reasons for including SCC in the name; it'll be called TFSActivityLogging in the shipping product.

There are two tables in this database: one records information about each web method and the other contains parameter information for each web method.

A simple query that shows web method activity plus the parameters (SOAP parameters) is (note: the LEFT join is necessary since there may not be values from the parameter table for each command):

select *
from tbl_command (nolock) c
left join tbl_parameter (nolock) p
on c.commandid = p.commandid

The command table contains information about the web method itself and includes:

  • Command identifier A unique id used as a key in the parameter table
  • Application Identifies the Team Foundation Web Application servicing the web method
  • Command The name of the web method
  • StartTime When the web method was invoked
  • ExecutionTime How long the web method executed (microseconds)
  • IdentityName The user invoking the web method
  • IPAddress Origination of the web method execution request
  • UserAgent The provided user agent string (this will contain the name of the executable as well)
  • UniqueIdentifier (optional) When specified, this value correlates multiple web method records. E.g., a command like checkin will perform multiple web method calls. The identifier correlates the web method calls made for a specific occurrence of the command.
  • CommandIdentifier (optional) The name of the command-line tool that's invoking the web method (note that a single command like shelve will perform multiple web methods)

The parameter table is pretty straight forward -- note that parameters are conditionally reported.

  • CommandId Correlates to an entry in the command table
  • ParameterName The name of the parameter
  • ParameterValue The value of the parameter

Comments

  • Anonymous
    August 11, 2005
    Based on what I've seen in the MSDN forums, people are having different problems migrating their code...

  • Anonymous
    August 20, 2005
    John Lawrence posted the latest set of dogfood system statistics.&amp;nbsp; The deltas are from May I think,...

  • Anonymous
    August 29, 2005
    In my last post, I wrote about the mechanism within Team Foundation that records web method activity....

  • Anonymous
    August 30, 2005
    How are you hooking into the actual method call? I am trying to build the same thing and am trying to design so that all webservices inherit from this "logging" service so that when a method is invoked, it will automatically log. Make sense?

  • Anonymous
    September 06, 2005
    <P>Note: To achieve full transparency, you can use Soap extensions. There are many places where these are described. Basically, by implementing a Soap extension, you can insert code into the Soap pipeline.</P>
    <P>A Soap extension can do logging, tracing, encryption/decryption, compression/decompression as well as implement policy on who or which application may access web methods.</P>
    <P>I've been toying with a Soap extension to provide a framework for a policy mechanism to implement restrictions based on time-of-day, user agent, user, web method, target application, etc.</P>

  • Anonymous
    September 03, 2006
    We already saw how we could use the QueryServerRequests web method to tell the calls that are actively...

  • Anonymous
    September 05, 2006
    James Manning shares some more PowerShell goodness in his post that describes&amp;nbsp;how to watch Team...

  • Anonymous
    April 19, 2007
    I wrote posts when we hit 1,000,000 files (Nov. 18, 2005) and 10,000 changesets (Sept. 26, 2005) on the

  • Anonymous
    August 24, 2007
    The comment has been removed