Azure Monitor - Determining what aggregation interval to use
See original GitHub issueI’m currently working on Promitor which is scraping the Azure Monitor API for metrics based on a configuration file.
As part of an Azure Monitor query an interval needs to be defined in order to specify the metrics granularity such as:
var metricQuery = metricDefinition.DefineQuery()
.StartingFrom(recordDateTime.AddDays(-5))
.EndsBefore(recordDateTime)
.WithAggregation(metricAggregation.ToString())
.WithInterval(TimeSpan.FromMinutes(5));
However, depending on the metric this is different and the value needs to be exact. Otherwise you will have exceptions like these:
Invalid time grain duration: PT3M, supported ones are: 00:01:00,00:05:00,00:15:00,00:30:00,01:00:00,06:00:00,12:00:00,1.00:00:00
This brings me with a few questions:
- What is the best approach to ensure that these are correct? Is that to check the “Metric Availabilities” for a specific metric and verify that it’s present?
- Are they really different for every metric or is there an enum that can help us with this?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Azure Monitor metrics aggregation and display explained
In this case, all the data from all the individual servers are aggregated into a 1-minute interval metric and stored in the metrics...
Read more >Advanced features of Metrics Explorer - Azure Monitor
Count : The number of measurements captured during the aggregation interval. When the metric is always captured with the value of 1, the...
Read more >Analyze metrics for an Azure resource - Azure Monitor
The chart uses the specified aggregation to calculate all sampled values over the time granularity specified.
Read more >Azure Monitoring Complete Guide (2023)
Azure Monitor can capture metrics in near real-time. The metrics are collected at regular intervals and are useful for alerting because of their...
Read more >Aggregating pre-aggregated metrics in Azure Monitor
Short version. Suppose your metrics are called “TestMetrics” and you'd like to aggregate all the values. You can use this query in Log...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hovsepm, @tomkerkhove : The metric granularity enums are PT1M PT5M PT15M PT30M PT1H PT6H PT1D. Most metrics support all of these granulartires. However there are some exceptions, a few metrics only support PT5M, or only support PT1H and higher. As you guessed @tomkerkhove the only way to know is to call “Metric Availabilities”.
@anirudhcavale could you help here?