public MetricsTransactionsEntity Merge(MetricsTransactionsEntity b)
{
var ret = new MetricsTransactionsEntity();
ret.PartitionKey = this.PartitionKey;
ret.RowKey = this.RowKey;
ret.TimeSpan = this.TimeSpan + b.TimeSpan;
ret.TotalIngress = this.TotalEgress + b.TotalIngress;
ret.TotalEgress = this.TotalEgress + b.TotalEgress;
ret.TotalRequests = this.TotalRequests + b.TotalRequests;
ret.TotalBillableRequests = this.TotalBillableRequests + b.TotalBillableRequests;
ret.PercentSuccess = (this.Success + b.Success) /
((this.Success * 100 / this.PercentSuccess) + (b.Success * 100 / b.PercentSuccess));
//long ac =this.ThrottlingError+this.SASThrottlingError+this.AnonymousThrottlingError;
//long bc =b.ThrottlingError+b.SASThrottlingError+b.AnonymousThrottlingError;
//ret.PercentThrottlingError = (ac+bc) /
// ((ac * 100 / this.PercentThrottlingError) + (bc * 100 / b.PercentThrottlingError));
//long ac2= this.AnonymousClientTimeoutError+this.AnonymousServerTimeoutError+
// this.SASClientTimeoutError+this.SASServerTimeoutError+
// this.ClientTimeoutError+this.ServerTimeoutError;
//long bc2 = b.AnonymousClientTimeoutError + b.AnonymousServerTimeoutError +
// b.SASClientTimeoutError + b.SASServerTimeoutError +
// b.ClientTimeoutError + b.ServerTimeoutError;
//ret.PercentTimeoutError = (ac2 + bc2) /
// ((ac2 * 100 / this.PercentTimeoutError) + (bc2 * 100 / b.PercentTimeoutError));
//ret.PercentClientOtherError = (this.ClientOtherError + b.ClientOtherError) /
// ((this.ClientOtherError * 100 / this.PercentClientOtherError) + (b.ClientOtherError * 100 / b.PercentClientOtherError));
//ret.PercentServerOtherError = (this.ServerOtherError + b.ServerOtherError) /
// ((this.ServerOtherError * 100 / this.PercentServerOtherError) + (b.ServerOtherError * 100 / b.PercentServerOtherError));
//long ac3 = this.AuthorizationError + this.AnonymousAuthorizationError + this.SASAuthorizationError;
//long bc3 = b.AuthorizationError + b.AnonymousAuthorizationError + b.SASAuthorizationError;
//ret.PercentAuthorizationError = (ac3 + bc3) /
// ((ac3 * 100 / this.PercentAuthorizationError) + (bc3 * 100 / b.PercentAuthorizationError));
//long ac4 = this.NetworkError + this.AnonymousNetworkError + this.SASNetworkError;
//long bc4 = b.NetworkError + b.AnonymousNetworkError + b.SASNetworkError;
//ret.PercentAuthorizationError = (ac4 + bc4) /
// ((ac4 * 100 / this.PercentNetworkError) + (bc4 * 100 / b.PercentNetworkError));
// possible issue
ret.PercentThrottlingError = (this.PercentThrottlingError + b.PercentThrottlingError) / 2;
ret.PercentTimeoutError = (this.PercentTimeoutError + b.PercentTimeoutError) / 2;
ret.PercentNetworkError = (this.PercentNetworkError + b.PercentNetworkError) / 2;
ret.PercentAuthorizationError = (this.PercentAuthorizationError + b.PercentAuthorizationError) / 2;
ret.PercentClientOtherError = (this.PercentClientOtherError + b.PercentClientOtherError) / 2;
ret.PercentServerOtherError = (this.PercentServerOtherError + b.PercentServerOtherError) / 2;
ret.PercentSuccess = (this.PercentSuccess + b.PercentSuccess) / 2;
ret.AverageE2ELatency = (this.AverageE2ELatency * this.TotalRequests + b.AverageE2ELatency * b.TotalRequests) / (this.TotalRequests + b.TotalRequests);
ret.AverageServerLatency = (this.AverageServerLatency * this.TotalRequests + b.AverageServerLatency * b.TotalRequests) / (this.TotalRequests + b.TotalRequests);
ret.Availability = (this.Availability * this.TotalRequests + b.Availability * b.TotalRequests) / (this.TotalRequests + b.TotalRequests);
ret.Success = this.Success + b.Success;
ret.AnonymousSuccess = this.AnonymousSuccess + b.AnonymousSuccess;
ret.SASSuccess = this.SASSuccess + b.SASSuccess;
ret.ThrottlingError = this.ThrottlingError + b.ThrottlingError;
ret.AnonymousThrottlingError = this.AnonymousThrottlingError + b.AnonymousThrottlingError;
ret.SASThrottlingError = this.SASThrottlingError + b.SASThrottlingError;
ret.ClientTimeoutError = this.ClientTimeoutError + b.ClientTimeoutError;
ret.AnonymousClientTimeoutError = this.AnonymousClientTimeoutError + b.AnonymousClientTimeoutError;
ret.SASClientTimeoutError = this.SASClientTimeoutError + b.SASClientTimeoutError;
ret.ServerTimeoutError = this.ServerTimeoutError + b.ServerTimeoutError;
ret.AnonymousServerTimeoutError = this.AnonymousServerTimeoutError + b.AnonymousServerTimeoutError;
ret.SASServerTimeoutError = this.SASServerTimeoutError + b.SASServerTimeoutError;
ret.ClientOtherError = this.ClientOtherError + b.ClientOtherError;
ret.AnonymousClientOtherError = this.AnonymousClientOtherError + b.AnonymousClientOtherError;
ret.SASClientOtherError = this.SASClientOtherError + b.SASClientOtherError;
ret.ServerOtherError = this.ServerOtherError + b.ServerOtherError;
ret.AnonymousServerOtherError = this.AnonymousServerOtherError + b.AnonymousServerOtherError;
ret.SASServerOtherError = this.SASServerOtherError + b.SASServerOtherError;
ret.AuthorizationError = this.AuthorizationError + b.AuthorizationError;
ret.AnonymousAuthorizationError = this.AnonymousAuthorizationError + b.AnonymousAuthorizationError;
ret.SASAuthorizationError = this.SASAuthorizationError + b.SASAuthorizationError;
ret.NetworkError = this.NetworkError + b.NetworkError;
ret.AnonymousNetworkError = this.AnonymousNetworkError + b.AnonymousNetworkError;
ret.SASNetworkError = this.SASNetworkError + b.SASNetworkError;
return ret;
}