如何从 TFS 获取类似 git 的统计信息

发布于 2024-11-07 10:41:48 字数 139 浏览 2 评论 0原文

我已经与 TFS 合作几个月了,希望获得一些基本统计数据并将其提供给我们的团队。在 git 中,我可以检索有关“按作者提交”和“按日期提交”等的统计信息。

我想显示来自 TFS(或来自 TeamCity)的类似统计信息。

这可能吗?

I've been working with TFS for a few months now and would like to get some basic statistics and make them available to our team. In git, i could retrieve statistics on "commit by author" and "commit by date" etc.

I'd like to show similar statistics from TFS (or from TeamCity).

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

独行侠 2024-11-14 10:41:48

我发现研究 TFS 统计数据的最简单方法是使用 Excel 报告 - 您可以根据您能想象到的任何内容进行分析。有关入门指南,请查看我写的这篇博客文章:

http://www.woodwardweb .com/vsts/getting_started.html

TFS 在常规存储库数据之上提供了一个完整的数据仓库供您深入研究。

The easiest way I find for poking around in TFS statistics is to play with Excel reports - you can pivot on just about anything you can imagine. For a guide to getting started take a look at this blog post I wrote:

http://www.woodwardweb.com/vsts/getting_started.html

TFS provides a full data warehouse over the top of the regular repository data for you to dig into.

全部不再 2024-11-14 10:41:48

您可以使用 TFS API 创建任何您喜欢的查询。您可以非常轻松地遍历变更集,查找特定作者的所有提交或在特定日期提交的所有提交:

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://tfsserver:8080/"));
tpc.EnsureAuthenticated();
VersionControlServer vcs = tpc.GetService<VersionControlServer>(); 

int latest = vcs.GetLatestChangesetId();
DateTime earliestDate = new DateTime(2011, 1, 1);
do
{
    var changeset = vcs.GetChangeset(latest);                
    if (changeset.CreationDate < earliestDate)
    {
        break;
    }
    // do analysis of the changeset here,
    // e.g. use changeset.Committer or changeset.Changes
} while (latest-- > 0);

You can use the TFS API to create any queries you like. You can quite easily iterate through the changesets looking for all commits by a certain author, or commits in a certain date:

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://tfsserver:8080/"));
tpc.EnsureAuthenticated();
VersionControlServer vcs = tpc.GetService<VersionControlServer>(); 

int latest = vcs.GetLatestChangesetId();
DateTime earliestDate = new DateTime(2011, 1, 1);
do
{
    var changeset = vcs.GetChangeset(latest);                
    if (changeset.CreationDate < earliestDate)
    {
        break;
    }
    // do analysis of the changeset here,
    // e.g. use changeset.Committer or changeset.Changes
} while (latest-- > 0);
鱼忆七猫命九 2024-11-14 10:41:48

在这里您可以找到一些可以在 TFS 数据库上执行的查询来获取一些统计信息。

-- Change this to the name of your collection DB. You’ll need to run these queries for each of your collection DBs. 
USE Tfs_DefaultCollection 
GO

-- Recent Users 
select count(distinct IdentityName) as [Recent Users] from tbl_Command with (nolock)

-- Users with Assigned Work Items 
select count(distinct [System.AssignedTo]) AS [Users with Assigned Work Items] from WorkItemsAreUsed with (nolock)

-- Version Control Users 
select COUNT(*) AS [Version Control Users] from [Tfs_Configuration].[dbo].tbl_security_identity_cache as ic JOIN tbl_Identity as i ON i.TeamFoundationId=ic.tf_id where ic.is_group = 0

-- Total Work Items 
select count(*) AS [Total Work Items] from WorkItemsAreUsed with (nolock)

-- Areas and Iterations 
select count(*) AS [Areas and Iterations] from tbl_nodes with (nolock)

-- Work Item Versions 
select count(*) AS [Work Item Versions] from (select [System.Id] from WorkItemsAreUsed with (nolock) union all select [System.Id] from WorkItemsWereUsed with (nolock)) x 
-- Work Item Attachments 
select count(*) AS [Work Item Attachments] from WorkItemFiles with (nolock) where FldID = 50 
-- Work Item Queries 
select count(*) AS [Work Item Queries] from QueryItems with (nolock)

-- Files 
select count(*) as [Files] from tbl_VersionedItem vi with (nolock) join tbl_Version v with (nolock) on v.ItemId = vi.ItemId where VersionTo = 2147483647

-- Compressed File Sizes 
select (sum(convert(bigint,OffsetTo - OffsetFrom + 1)) / (1024 * 1024)) AS [Compressed File Sizes] from tbl_Content with (nolock)

-- Uncompressed File Sizes 
select (sum(FileLength) / (1024 * 1024)) AS [Uncompressed File Sizes] from tbl_File with (nolock)

-- Checkins 
select max(ChangeSetId) AS [Checkins] from tbl_ChangeSet with (nolock)

-- Shelvesets 
select COUNT(*) AS [Shelvesets] from tbl_Workspace with (nolock) where type='1'

-- Merge History 
select SUM(st.row_count) AS [Merge History] from sys.dm_db_partition_stats st WHERE object_name(object_id) = 'tbl_MergeHistory' AND (index_id < 2)

-- Pending Changes 
select count(*) AS [Pending Changes] from tbl_PendingChange pc with (nolock) join tbl_Workspace w with (nolock) on pc.WorkspaceId = w.WorkspaceId where w.Type = 0 
-- Workspaces 
select COUNT(*) AS [Workspaces] from tbl_Workspace with (nolock) where type='0' 
-- Local Copies 
select SUM(st.row_count) AS [Local Copies] from sys.dm_db_partition_stats st WHERE object_name(object_id) = 'tbl_LocalVersion' AND (index_id < 2)

-- Command Counts 
select Command, count(*) as [Execution Count] from tbl_Command with (nolock) WHERE Command IN ('QueryWorkitems', 'Update', 'GetWorkItem', 'Get', 'VCDownloadHandler', 'Checkin', 'Upload', 'Shelve') GROUP BY Command, Application ORDER BY [Application],[Command]

Here you can find some queries you can execute on the TFS database to get some statistics.

-- Change this to the name of your collection DB. You’ll need to run these queries for each of your collection DBs. 
USE Tfs_DefaultCollection 
GO

-- Recent Users 
select count(distinct IdentityName) as [Recent Users] from tbl_Command with (nolock)

-- Users with Assigned Work Items 
select count(distinct [System.AssignedTo]) AS [Users with Assigned Work Items] from WorkItemsAreUsed with (nolock)

-- Version Control Users 
select COUNT(*) AS [Version Control Users] from [Tfs_Configuration].[dbo].tbl_security_identity_cache as ic JOIN tbl_Identity as i ON i.TeamFoundationId=ic.tf_id where ic.is_group = 0

-- Total Work Items 
select count(*) AS [Total Work Items] from WorkItemsAreUsed with (nolock)

-- Areas and Iterations 
select count(*) AS [Areas and Iterations] from tbl_nodes with (nolock)

-- Work Item Versions 
select count(*) AS [Work Item Versions] from (select [System.Id] from WorkItemsAreUsed with (nolock) union all select [System.Id] from WorkItemsWereUsed with (nolock)) x 
-- Work Item Attachments 
select count(*) AS [Work Item Attachments] from WorkItemFiles with (nolock) where FldID = 50 
-- Work Item Queries 
select count(*) AS [Work Item Queries] from QueryItems with (nolock)

-- Files 
select count(*) as [Files] from tbl_VersionedItem vi with (nolock) join tbl_Version v with (nolock) on v.ItemId = vi.ItemId where VersionTo = 2147483647

-- Compressed File Sizes 
select (sum(convert(bigint,OffsetTo - OffsetFrom + 1)) / (1024 * 1024)) AS [Compressed File Sizes] from tbl_Content with (nolock)

-- Uncompressed File Sizes 
select (sum(FileLength) / (1024 * 1024)) AS [Uncompressed File Sizes] from tbl_File with (nolock)

-- Checkins 
select max(ChangeSetId) AS [Checkins] from tbl_ChangeSet with (nolock)

-- Shelvesets 
select COUNT(*) AS [Shelvesets] from tbl_Workspace with (nolock) where type='1'

-- Merge History 
select SUM(st.row_count) AS [Merge History] from sys.dm_db_partition_stats st WHERE object_name(object_id) = 'tbl_MergeHistory' AND (index_id < 2)

-- Pending Changes 
select count(*) AS [Pending Changes] from tbl_PendingChange pc with (nolock) join tbl_Workspace w with (nolock) on pc.WorkspaceId = w.WorkspaceId where w.Type = 0 
-- Workspaces 
select COUNT(*) AS [Workspaces] from tbl_Workspace with (nolock) where type='0' 
-- Local Copies 
select SUM(st.row_count) AS [Local Copies] from sys.dm_db_partition_stats st WHERE object_name(object_id) = 'tbl_LocalVersion' AND (index_id < 2)

-- Command Counts 
select Command, count(*) as [Execution Count] from tbl_Command with (nolock) WHERE Command IN ('QueryWorkitems', 'Update', 'GetWorkItem', 'Get', 'VCDownloadHandler', 'Checkin', 'Upload', 'Shelve') GROUP BY Command, Application ORDER BY [Application],[Command]
梦忆晨望 2024-11-14 10:41:48

我发现 Visual Studio Team System Web Access 中的“源”选项卡下有一个更改集视图。选择所需的项目并从项目下拉列表中选择版本历史记录。

这足以满足我的需求。

I found that there is a change set view in Visual Studio Team System Web Access under the "source" tab. Selected desired project and select version history from the project dropdown.

This is sufficient for my needs.

别靠近我心 2024-11-14 10:41:48

有一个 TFS 性能报告包 将为您提供信息,但它并不完全是您请求的信息

  • 执行时间摘要
  • 服务器状态 - 源代码控制请求队列
  • 服务器状态 - 绕过代理的主要用户
  • 服务器状态- 历史性能趋势
  • 服务器状态 - 最近性能趋势

There is a TFS Performance Report Pack which will give you information, but it is not exactly the information you requested

  • Execution Time Summary
  • Server Status - Source Control Request Queue
  • Server Status - Top Users Bypassing Proxies
  • Server Status - Historical Performance Trends
  • Server Status - Recent Performance Trends
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文