Akka.Cluster.NodeMetrics.Metric C# (CSharp) Method

Metric() public method

Return the metric that matches key. Returns null if not found.
public Metric ( string key ) : Metric
key string
return Metric
        public Metric Metric(string key)
        {
            return Metrics.FirstOrDefault(metric => metric.Name.Equals(key));
        }

Usage Example

            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));
            }
All Usage Examples Of Akka.Cluster.NodeMetrics::Metric