The snapshot of current sampled health metrics for any monitored process. Collected and gossiped at regular intervals for dynamic cluster management strategies. Equality of NodeMetrics is based on its Address.
Пример #1
0
 /// <summary>
 /// Returns the most recent data
 /// </summary>
 public NodeMetrics Merge(NodeMetrics that)
 {
     if (Address != that.Address)
     {
         throw new ArgumentException(string.Format("NodeMetrics.merge is only allowed for the same address. {0} != {1}", Address, that.Address));
     }
     if (Timestamp >= that.Timestamp)
     {
         return(this);                             //that is older
     }
     return(new NodeMetrics(Address, that.Timestamp, that.Metrics.Union(Metrics)));
 }
Пример #2
0
            public static SystemMemory ExtractSystemMemory(NodeMetrics nodeMetrics)
            {
                var used      = nodeMetrics.Metric(ClrProcessMemoryUsed);
                var available = nodeMetrics.Metric(SystemMemoryAvailable);

                if (used == null || available == null)
                {
                    return(null);
                }
                var max = nodeMetrics.Metric(SystemMemoryAvailable) != null ? (long?)Convert.ToInt64(nodeMetrics.Metric(SystemMemoryMax).SmoothValue) : null;

                return(new SystemMemory(nodeMetrics.Address, nodeMetrics.Timestamp,
                                        Convert.ToInt64(used.SmoothValue), Convert.ToInt64(available.SmoothValue), max));
            }
Пример #3
0
            /// <summary>
            /// Given a <see cref="NodeMetrics"/> it returns the <see cref="Cpu"/> data of the nodeMetrics
            /// contains the necessary cpu metrics.
            /// </summary>
            public static Cpu ExtractCpu(NodeMetrics nodeMetrics)
            {
                var processors = nodeMetrics.Metric(Processors);

                if (processors == null)
                {
                    return(null);
                }
                var systemLoadAverage = nodeMetrics.Metric(SystemLoadAverage) != null ? (double?)nodeMetrics.Metric(SystemLoadAverage).SmoothValue : null;
                var cpuCombined       = nodeMetrics.Metric(CpuCombined) != null
                    ? (double?)nodeMetrics.Metric(CpuCombined).SmoothValue
                    : null;

                return(new Cpu(nodeMetrics.Address, nodeMetrics.Timestamp, Convert.ToInt32(processors.Value), systemLoadAverage, cpuCombined));
            }
            /// <summary>
            /// Given a <see cref="NodeMetrics"/> it returns the <see cref="Cpu"/> data of the nodeMetrics
            /// contains the necessary cpu metrics.
            /// </summary>
            public static Cpu ExtractCpu(NodeMetrics nodeMetrics)
            {
                var processors = nodeMetrics.Metric(Processors);
                if (processors == null) return null;
               var systemLoadAverage = nodeMetrics.Metric(SystemLoadAverage) != null ? (double?)nodeMetrics.Metric(SystemLoadAverage).SmoothValue : null;
               var cpuCombined = nodeMetrics.Metric(CpuCombined) != null
                    ? (double?)nodeMetrics.Metric(CpuCombined).SmoothValue
                    : null;

                return new Cpu(nodeMetrics.Address, nodeMetrics.Timestamp, Convert.ToInt32(processors.Value), systemLoadAverage, cpuCombined);
            }
 public static SystemMemory ExtractSystemMemory(NodeMetrics nodeMetrics)
 {
     var used = nodeMetrics.Metric(ClrProcessMemoryUsed);
     var available = nodeMetrics.Metric(SystemMemoryAvailable);
     if (used == null || available == null) return null;
     var max = nodeMetrics.Metric(SystemMemoryAvailable) != null ? (long?)Convert.ToInt64(nodeMetrics.Metric(SystemMemoryMax).SmoothValue) : null;
     return new SystemMemory(nodeMetrics.Address, nodeMetrics.Timestamp, 
         Convert.ToInt64(used.SmoothValue), Convert.ToInt64(available.SmoothValue), max);
 }
 /// <summary>
 /// Returns the most recent data
 /// </summary>
 public NodeMetrics Merge(NodeMetrics that)
 {
     if(Address != that.Address) throw new ArgumentException(string.Format("NodeMetrics.merge is only allowed for the same address. {0} != {1}", Address, that.Address));
     if (Timestamp >= that.Timestamp) return this; //that is older
     return new NodeMetrics(Address, that.Timestamp, that.Metrics.Union(Metrics));
 }
 protected bool Equals(NodeMetrics other)
 {
     return Address.Equals(other.Address);
 }
Пример #8
0
 protected bool Equals(NodeMetrics other)
 {
     return(Address.Equals(other.Address));
 }