0
votes

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

So I'm confused as to how to generate this rowkey value, as I have no idea what the aggregation period is. I've tried the last minute or the last hour with no luck, despite the ticks being very similar.

1

1 Answers

1
votes

1. The aggregation period

If you enable diagnostic for a VM, all the metrics data will be stored in a storage account table.

enter image description here

The aggregation period is in the table name. For example: WADMetricsPT1HP10DV2S20190927

PT1H / PT1M: The MetricAggregation value of PT1M and PT1H signify an aggregation over a minute and an aggregation over an hour

P10D : It means that it contains 10 days data

20190927: It is the start aggregation period.


2. Rowkey value

Just as mentioned in the official documentation, it follows the format : The descending time tick calculation is max time ticks minus the time of the beginning of the aggregation period.

I will take one record in my table as a sample:

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

Firstly, the RowKey value contains some Basic Latin characters in Unicode.

:005C = \
:0020 = blank space

So, the readable RowKey would looks like:

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

Then, let's talk about the number -- 2518363979999999999.

As the record is from table "WADMetricsPT1HP10DV2S20190808", so:

In C#, you may get the value as:

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

In java, you may try the following code:

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")));
    }
}