简体   繁体   中英

Which Azure metrics aggregation type returns decimal values?

I am using Azure metrics for evaluation of how healthy my Azure resource is, by collecting its default aggregation type for each metric of a resource. I can see the MetricValue class in the Microsoft.Azure.Management.Monitor.Fluent.Models namespace of the SDK would return the value of type double for all the Aggregation types.

namespace Microsoft.Azure.Management.Monitor.Fluent.Models
{
    public class MetricValue
    {
        public MetricValue();
        public MetricValue(DateTime timeStamp, double? average = null, double? minimum = null, double? maximum = null, double? total = null, double? count = null);

        public DateTime TimeStamp { get; set; }
        public double? Average { get; set; }
        public double? Minimum { get; set; }
        public double? Maximum { get; set; }
        public double? Total { get; set; }
        public double? Count { get; set; }
        public virtual void Validate();
    }
}

My question here is (considering the double data type), are there actually chances for all the Azure metrics of all services to return decimal values? I can see the count of messages in a service bus metric returns decimal values at times. I do not find specific docs related to my question to get clarified. Thanks.

Because metric can be anything and MetricValue is a general common type/schema which needs to cater all kinds of metrics, some requiring highest possible precision, very high or low values (+ve or -ve), and also to be persisted in the underlying common data store (for example Azure Monitor). Now while some metric may be integer depending on the unit in the context (for example, when you say my request took 300 milliseconds), some may not (for example, there is 20.57 GB free disk space available). And remember, apart from the inbuilt Azure metrics, there can custom metrics from your application which can be possibly anything under imagination. So, to accommodate enough high precision possible, double is the choice. That explains Average, Minimum, Maximum, Total. But then why Count is also double , I am not fully sure, but most possibly to accommodate a super high number just in case needed and we are not exhausted with int or long. Or it might be that count within a time window which can be decimal (10.6 request per minute).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM