Description
Describe the bug
On the EventHub resource (and might be on others as well) when we query using metricsQueryClient.queryResourceWithResponse
and using filters with aggregations the result on some aggregations (all but the first one) is null. If you remove the filter then we get valid results.
Exception or Stack Trace
No exception.
To Reproduce
Create an EventHub with a test entity. populate it with some records.
then execute the following code.
Code Snippet
val tenantId = "XXXX"
val clientId = "XXXX"
val clientSecret = "XXXXX"
val clientSecretCredential: ClientSecretCredential = ClientSecretCredentialBuilder()
.clientId(clientId)
.clientSecret(clientSecret)
.tenantId(tenantId)
.build()
val metricsQueryClient = MetricsQueryClientBuilder()
.credential(clientSecretCredential)
.buildClient()
val id = "/subscriptions/XXXXX/resourceGroups/XXXX/providers/Microsoft.EventHub/namespaces/eventhubplayground"
val metricName = "Size"
val res11 = metricsQueryClient.queryResourceWithResponse(
id,
listOf(metricName),
MetricsQueryOptions()
.setAggregations(AggregationType.COUNT, AggregationType.AVERAGE, AggregationType.MAXIMUM,
AggregationType.MINIMUM, AggregationType.TOTAL)
.setFilter("EntityName eq '*'"),
Context.NONE
)
.value
.metrics
val res12 = metricsQueryClient.queryResourceWithResponse(
id,
listOf(metricName),
MetricsQueryOptions()
.setAggregations(AggregationType.MAXIMUM, AggregationType.AVERAGE, AggregationType.COUNT,
AggregationType.MINIMUM, AggregationType.TOTAL),
Context.NONE
)
.value
.metrics
Expected behavior
res11
timeseries contain nulls:
while res12
timeseries contain the correct values:
and if you take recent value you will also other timestamp you see the values.
Screenshots
attached.
Setup (please complete the following information):
- OS: macOS 14.0
- IDE: 2023.2.3
- Library/Libraries:
implementation("com.azure.resourcemanager:azure-resourcemanager:2.31.0")
implementation("com.azure:azure-identity:1.10.3")
implementation("com.azure:azure-monitor-query:1.3.0-beta.2")
- Java version: 11
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added