收集 .NET Statistic/Avg. Request Time (ms)

Microsoft.SystemCenter.Apm.Transaction.CollectAvgDurationTime (Rule)

收集 .NET Statistic/Avg. Request Time 效能計數器 (毫秒)

Knowledge Base article:

摘要

此規則會收集交易的 .NET Statistic Avg execution time 效能計數器。

此計數器會記錄交易處理要求所花費的平均時間 (以毫秒為單位)。 每個要求的計時在要求到達應用程式時即開始,並在要求順利完成或程式碼失敗時停止計時。 這些時間的加總為受監視要求的總數目平均值。 如果此時間持續超過 10000 ms,表示其中內含需要進行調查的瓶頸。

此計數器只有在啟用應用程式效能監視時可以使用。

資料庫的呼叫時間過長可能是因為資料庫伺服器或查詢的結構與複雜度出現問題。 檔案 I/O 的時間過長可能是因為檔案伺服器發生問題。 Web 服務的效能問題可能是由於 Web 服務或該服務所在伺服器已關機,或是 Web 服務程式碼有問題。 應用程式的內部執行時間過長可能是由於程式碼太過複雜或缺乏效率。

Element properties:

TargetMicrosoft.SystemCenter.Apm.Transaction
CategoryPerformanceCollection
EnabledTrue
Instance Name.NET Statistic
Counter NameAvg execution time
Frequency300
Alert GenerateFalse
RemotableFalse

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.Performance.DataProvider Default
WriteToDB WriteAction Microsoft.SystemCenter.CollectPerformanceData Default
WriteToDW WriteAction Microsoft.SystemCenter.DataWarehouse.PublishPerformanceData Default

Source Code:

<Rule ID="Microsoft.SystemCenter.Apm.Transaction.CollectAvgDurationTime" Enabled="true" Target="Microsoft.SystemCenter.Apm.Transaction" ConfirmDelivery="false" Remotable="false" Priority="Normal" DiscardLevel="100">
<Category>PerformanceCollection</Category>
<DataSources>
<DataSource ID="DS" TypeID="Performance!System.Performance.DataProvider">
<ComputerName>$Target/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<CounterName>Avg execution time</CounterName>
<ObjectName>.NET Statistic</ObjectName>
<InstanceName>$Target/Property[Type="Microsoft.SystemCenter.Apm.Transaction"]/CounterInstance$</InstanceName>
<AllInstances>false</AllInstances>
<Frequency>300</Frequency>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WriteToDB" TypeID="SC!Microsoft.SystemCenter.CollectPerformanceData"/>
<WriteAction ID="WriteToDW" TypeID="SCDW!Microsoft.SystemCenter.DataWarehouse.PublishPerformanceData"/>
</WriteActions>
</Rule>