示例#1
0
        /// <summary>
        /// Increment the specified counter by a defined amount.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        public void Increment(HealthCounterType type, string instance, double value)
        {
            if (value == 0 || core.Settings.RecordInstanceHealth == false)
            {
                return;
            }

            lock (Counters)
            {
                var counter = (from o in Counters where o.Type == type && o.Instance == instance select o).FirstOrDefault();
                if (counter != null)
                {
                    counter.Value += value;
                }
                else
                {
                    Counters.Add(new HealthCounter()
                    {
                        Type     = type,
                        Value    = value,
                        Instance = instance
                    });
                }

                if ((DateTime.UtcNow - lastCheckpoint).TotalSeconds > 600)
                {
                    Checkpoint();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Increment the specified counter by a defined amount.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        public void Increment(HealthCounterType type, double value)
        {
            if (value == 0)
            {
                return;
            }

            lock (Counters)
            {
                var counter = (from o in Counters where o.Type == type select o).FirstOrDefault();
                if (counter != null)
                {
                    counter.Value += value;
                }
                else
                {
                    Counters.Add(new HealthCounter()
                    {
                        Type  = type,
                        Value = value
                    });
                }

                if ((DateTime.UtcNow - lastCheckpoint).TotalSeconds > 600)
                {
                    Checkpoint();
                }
            }
        }
示例#3
0
 /// <summary>
 /// Increment the specified counter by 1.
 /// </summary>
 /// <param name="type"></param>
 public void Increment(HealthCounterType type, string instance)
 {
     Increment(type, instance, 1);
 }
示例#4
0
 /// <summary>
 /// Increment the specified counter by 1.
 /// </summary>
 /// <param name="type"></param>
 public void Increment(HealthCounterType type)
 {
     Increment(type, 1);
 }