Calculating Metric Values

Metrics are listed for the HostedServiceSummaryModel MC as seen in the following figure.
Figure 1. Monitoring context artifacts for hosted service summary processing
The metrics contained in the HostedServiceSummaryModel MC are for the three inbound event types that were discussed earlier, namely HostedServiceBeginSummary, HostedServiceEndSummary, and HostedServiceTxnFailure. The discussion here is for the HostedServiceEndSummary event and its metrics. These metrics typically are named with the prefix HostSvcEnd.
Each time a new HostedServiceEndSummary inbound event is processed, a new monitoring context instance is created and the metrics values that are associated with HostedServiceEndSummary events are computed.
Figure 2. Metric definition
There are a few metrics that use XPath functions to decorate the value extracted from the event. For example, there are metrics named with the prefix HostSvcEnd_Prefixed. These provide the Service, Channel, Transaction Type, and Currency names prefixed with the descriptions 'Service:', 'Channel:', 'TxnType:', and 'Currency:', respectively. The decorated form for these metrics helps to clarify the hierarchy being viewed on the FTM Dashboard analysis pages. Finally, there is a computed metric that plays a part in providing the weighted average for latency calculations. In Calculating Weighted Average Latency the technique of computing a weighted average value was described. It depended on a metric that is calculated based on two other metrics.

If you look at the definition for metric HostSvc_FactoredAvgTxnTime, you will see this expression:

HostSvcEnd_AvgTxnTime * HostSvcEnd_TxnComplete

By computing this for each event, the resulting metric value can be stored and used as described earlier to provided a weighted average latency value for a specified time frame.