An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
Azure Monitor Metrics Batch API – top Parameter Behavior and Complete Time Series Retrieval
We are using the Azure Monitor Metrics Batch API (metrics:getBatch, API version 2023-10-01) to retrieve metric time-series data across multiple resource IDs and dimensions.
According to the API documentation, the top parameter specifies the maximum number of records to retrieve per resource ID when a filter is specified, and its default value is 10. The documentation also mentions that paging is not supported and recommends splitting queries into multiple parallel requests when the response contains a large volume of metric data.
We would like to clarify the following points for production usage:
- Behavior when
topis reached If the number of matching time series is greater than the configuredtopvalue, does the API silently return only the top N time series, or does the response provide any indication that additional time series were omitted? - Maximum supported value of
topWhat is the maximum supported value for thetopparameter? - Observed maximum value During testing, we observed that
2,147,483,647is accepted, while2,147,483,648returns aBadRequestwith the error:Detected invalid TopN value ... should be Int value. Could you confirm whether2,147,483,647is the officially supported maximum value fortop? - Retrieving all matching time series If a production workload requires retrieving all matching time series across all dimensions, what approach does Microsoft recommend to ensure that no time series are missed?
- Recommended request-splitting strategy Since the Batch API does not support paging, should requests be split by:
- Resource ID
- Metric
- Dimension/filter
- A combination of these
- Or another recommended criteria?
- Detecting truncation Is there any response metadata, HTTP header, or other mechanism that can be used to determine whether the returned results were limited by the
topparameter?
References
Any clarification on the expected behavior and Microsoft's recommended approach for guaranteeing complete time-series retrieval would be greatly appreciated.