[8.14](backport #40367) Azure Monitor: fix metric timespan to restore Storage Account PT1H metrics #40413
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Move the timespan logic into a dedicated
buildTimespan()
function with a test for each supported use case.Some Azure services have longer latency between service usage and metric availability. For example, the Storage Account capacity metrics (Blob capacity, etc.) have a PT1H time grain and become available after one hour. Service X also has PT1H metrics, however become available after a few minutes.
This PR restores the core of the older timespan logic the Azure Monitor metricset was using before the regression introduced by the PR #36823.
However, the
buildTimespan()
does not restore theinterval * (-2)
part because doubling the interval causes duplicates.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
Microsoft.ContainerRegistry/registries
metrics (PT1M and PT1H)Microsoft.ContainerInstance/containerGroups
metrics (PT5M)Microsoft.KeyVault/vaults
metrics (PT1M)Related issues
This is an automatic backport of pull request #40367 done by [Mergify](https://mergify.com).