简体   繁体   English

哪种 Azure 指标聚合类型返回十进制值?

[英]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.我正在使用 Azure 指标来评估我的 Azure 资源的健康程度,方法是收集资源的每个指标的默认聚合类型。 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.我可以看到 SDK 的 Microsoft.Azure.Management.Monitor.Fluent.Models 命名空间中的 MetricValue 类将为所有聚合类型返回 double 类型的值。

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?我的问题是(考虑到双重数据类型),所有服务的所有 Azure 指标实际上都有机会返回十进制值吗? 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).因为 metric 可以是任何东西,而 MetricValue 是一种通用的通用类型/模式,它需要满足各种指标,有些需要尽可能高的精度、非常高或非常低的值(+ve 或 -ve),并且还需要保留在底层通用数据存储(例如 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).现在,虽然某些指标可能是整数,具体取决于上下文中的单位(例如,当您说我的请求花费了 300 毫秒时),但有些可能不是(例如,有 20.57 GB 可用磁盘空间)。 And remember, apart from the inbuilt Azure metrics, there can custom metrics from your application which can be possibly anything under imagination.请记住,除了内置的 Azure 指标外,您的应用程序还可以自定义指标,这些指标可能是想象中的任何东西。 So, to accommodate enough high precision possible, double is the choice.因此,为了容纳足够高的精度可能, double是选择。 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.但是为什么 Count 也是double ,我不完全确定,但最有可能容纳一个超高的数字,以防万一,我们不会因 int 或 long 而筋疲力尽。 Or it might be that count within a time window which can be decimal (10.6 request per minute).或者它可能是一个时间窗口内的计数,可以是十进制(每分钟 10.6 个请求)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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