public void LogSummary(string sequenceNumber, ThrottlingScope scope, ThrottlingResource resource, double resourceThreshold, ThrottlingImpactUnits impactUnits, uint impact, double impactRate, Guid externalOrganizationId, string recipient, string mdbName, IList <KeyValuePair <string, double> > mdbHealth, IList <KeyValuePair <string, string> > customData)
        {
            if (!this.enabled)
            {
                return;
            }
            ArgumentValidator.ThrowIfNullOrEmpty("sequenceNumber", sequenceNumber);
            LogRowFormatter logRowFormatter = new LogRowFormatter(DeliveryThrottlingLog.logSchema);

            logRowFormatter[2] = sequenceNumber;
            logRowFormatter[1] = ThrottlingEvent.SummaryThrottle;
            logRowFormatter[3] = scope;
            logRowFormatter[4] = resource;
            if (!resourceThreshold.Equals(double.NaN))
            {
                logRowFormatter[5] = resourceThreshold;
            }
            logRowFormatter[6] = impactUnits;
            logRowFormatter[7] = impact;
            logRowFormatter[8] = impactRate;
            if (externalOrganizationId != Guid.Empty)
            {
                logRowFormatter[9] = externalOrganizationId;
            }
            if (!string.IsNullOrEmpty(recipient))
            {
                logRowFormatter[10] = recipient;
            }
            if (!string.IsNullOrEmpty(mdbName))
            {
                logRowFormatter[11] = mdbName;
            }
            if (mdbHealth != null && mdbHealth.Count > 0)
            {
                logRowFormatter[12] = mdbHealth;
            }
            if (customData != null && customData.Count > 0)
            {
                logRowFormatter[13] = customData;
            }
            this.Append(logRowFormatter);
        }
Ejemplo n.º 2
0
 private void TrackData(Dictionary <string, DeliveryThrottlingLogData> dictionary, ReaderWriterLockSlim dictionaryLock, string key, bool isThrottle, ThrottlingScope scope, ThrottlingResource resource, double threshold, ThrottlingImpactUnits impactUnits, uint impactDelta, Guid tenantID, string recipient, string mdbName, IList <KeyValuePair <string, double> > health, IList <KeyValuePair <string, string> > customData)
 {
     if (dictionary == null)
     {
         throw new ArgumentNullException("dictionary");
     }
     if (dictionaryLock == null)
     {
         throw new ArgumentNullException("dictionaryLock");
     }
     dictionaryLock.EnterWriteLock();
     try
     {
         if (dictionary.ContainsKey(key))
         {
             if (isThrottle)
             {
                 dictionary[key].Impact += impactDelta;
             }
             dictionary[key].Total += (long)((ulong)impactDelta);
             if (dictionary[key].MDBHealth == null && health != null && health.Count > 0)
             {
                 dictionary[key].MDBHealth = health;
             }
             if (dictionary[key].CustomData == null && customData != null && customData.Count > 0)
             {
                 dictionary[key].CustomData = customData;
             }
         }
         else
         {
             DeliveryThrottlingLogData value;
             if (isThrottle)
             {
                 value = new DeliveryThrottlingLogData(scope, resource, threshold, impactUnits, impactDelta, (long)((ulong)impactDelta), tenantID, recipient, mdbName, health, customData);
             }
             else
             {
                 value = new DeliveryThrottlingLogData(scope, resource, threshold, impactUnits, 0U, (long)((ulong)impactDelta), tenantID, recipient, mdbName, health, customData);
             }
             dictionary.Add(key, value);
         }
     }
     finally
     {
         dictionaryLock.ExitWriteLock();
     }
 }
Ejemplo n.º 3
0
 public DeliveryThrottlingLogData(ThrottlingScope scope, ThrottlingResource resource, double resourceThreshold, ThrottlingImpactUnits impactUnits, uint impact, long total, Guid externalOrganizationId, string recipient, string mdbName, IList <KeyValuePair <string, double> > mdbHealth, IList <KeyValuePair <string, string> > customData)
 {
     this.ThrottlingScope    = scope;
     this.ThrottlingResource = resource;
     this.Threshold          = resourceThreshold;
     this.ImpactUnits        = impactUnits;
     this.Impact             = impact;
     this.Total = total;
     this.ExternalOrganizationId = externalOrganizationId;
     this.Recipient  = recipient;
     this.MDBName    = mdbName;
     this.MDBHealth  = mdbHealth;
     this.CustomData = customData;
 }