Azure 指标 table 中 RowKey 列中使用的 "aggregation period" 是什么?

What is the "aggregation period" used in RowKey column in the azure metrics table?

https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/diagnostics-template#wadmetrics-tables-in-storage

RowKey: Follows the format :. The descending time tick calculation is max time ticks minus the time of the beginning of the aggregation period. For example if the sample period started on 10-Nov-2015 and 00:00Hrs UTC then the calculation would be: DateTime.MaxValue.Ticks - (new DateTime(2015,11,10,0,0,0,DateTimeKind.Utc).Ticks). For the memory available bytes performance counter the row key will look like: 2519551871999999999__:005CMemory:005CAvailable:0020Bytes

所以我很困惑如何生成这个rowkey值,因为我不知道聚合周期是什么。尽管滴答非常相似,但我在最后一分钟或最后一小时尝试过但没有成功。

1。聚合期

如果为 VM 启用诊断,所有指标数据都将存储在存储帐户 table 中。

聚合期在table名字中。例如:WADMetricsPT1HP10DV2S20190927

PT1H / PT1M:PT1M 和 PT1H 的 MetricAggregation 值表示一分钟内的聚合和一小时内的聚合

P10D : 表示包含10天的数据

20190927:开始聚合期。


2。行键值

正如官方文档中所说,它遵循以下格式:递减时间刻度计算是最大时间刻度减去聚合周期开始的时间。

我将在我的table中取一条记录作为样本:

RowKey -> :2518363979999999999__:005CProcessor:0020Information:0028:005FTotal:0029:005C:0025:0020User:0020Time
TIMESTAMP -> 2019-08-15T21:00:00.000Z

首先,RowKey值包含一些Basic Latin characters in Unicode

:005C = \
:0020 = blank space

所以,可读的 RowKey 看起来像:

:2518363979999999999__:\Processor Information(-Total)\% User Time

然后,我们来说说这个数字——2518363979999999999。

由于记录来自 table "WADMetricsPT1HP10DV2S20190808",因此:

在 C# 中,您可能会得到以下值:

DateTime.MaxValue.Ticks - (new DateTime(2019,08,08,0,0,0,DateTimeKind.Utc).Ticks)

在java中,您可以试试下面的代码:

public class TickTest {

    public static Instant MAX = Instant.parse("9999-12-31T23:59:59.999Z");

    public static long toTicks(Instant start)
    {
        return toTicks(start, MAX);
    }

    public static long toTicks(Instant start, Instant end)
    {
        return Duration.between(start, end).toMillis() * 10000;
    }

    // Test
    public static void main(String[] args) {
        System.out.println(toTicks(Instant.parse("2019-08-08T00:00:00.000Z")));
    }
}