[BUG] Query 'Properties' returns 0 results
See original GitHub issueLibrary name and version
Azure.Monitor.Query 1.1.0
Describe the bug
I’m attempting to use the LogsQueryClient to pull data from a Log Analytics workspace and having issues with the query.
Using the following queries I’m getting inconsistent results when the ‘Properties’ field is used in a Kusto query:
AppMetrics | where Name == ‘PublicationView’ and Properties has ‘R2P9780986027956’ => returns 0 results with LogsClientQuery.QueryWorkspaceAsync / Log query in Azure workspace returns 174 results with same query
AppMetrics | where Name == ‘PublicationView’ and Properties has ‘R2P9780986027956’ and TimeGenerated between (datetime(‘2022-07-01 00:00:00’) … datetime(‘2022-07-06 23:59:59’)) => returns 0 results with LogsClientQuery.QueryWorkspaceAsync / Log query in Azure workspace returns 42 results with same query
AppMetrics | where Name == ‘PublicationView’ and TimeGenerated between (datetime(‘2022-07-01 00:00:00’) … datetime(‘2022-07-06 23:59:59’)) => returns 716 results with LogsClientQuery.QueryWorkspaceAsync / Log query in Azure workspace returns 716 results with same query
Expected behavior
Using the following code, the LogsQueryClient should return 42 results.
var query = $"AppMetrics | where Name == '{metricType}' and Properties has '{metricNamespace}'";
var response = await _logsQueryClient.QueryWorkspaceAsync(_workspaceId, query, new QueryTimeRange(startDate, endDate));
metricType = PublicationView metricNamespace = ‘R2P9780986027956’ startDate = ‘2022-07-01 00:00:00’ endDate = ‘2022-07-06 23:59:59’
Actual behavior
0 results are returned. Removing " and Properties has ‘{metricNamespace}’" does return results but any usage of Properties in the query returns 0 results .
Reproduction Steps
` var credential = new ClientSecretCredential(tenantId, clientId, clientSecret); _logsQueryClient = new LogsQueryClient(credential);
var startDate = DateTime.Parse(“2022-07-01 00:00:00”); var endDate = DateTime.Parse(“2022-07-06 23:59:59”); var metricType = “PublicationView”; var metricNamespace = “R2P9780986027956”;
var query = $“AppMetrics | where Name == ‘{metricType}’ and Properties has ‘{metricNamespace}’”; var response = await _logsQueryClient.QueryWorkspaceAsync(_workspaceId, query, new QueryTimeRange(startDate, endDate)); `
Environment
Visual Studio 2022 (17.2.5)
.NET SDK (reflecting any global.json): Version: 6.0.301 Commit: 43f9b18481
Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.301\
Host (useful for support): Version: 6.0.6 Commit: 7cca709db2
.NET SDKs installed: 3.1.420 [C:\Program Files\dotnet\sdk] 6.0.102 [C:\Program Files\dotnet\sdk] 6.0.106 [C:\Program Files\dotnet\sdk] 6.0.202 [C:\Program Files\dotnet\sdk] 6.0.203 [C:\Program Files\dotnet\sdk] 6.0.301 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@scottaddie Here is the requested screenshot. IsError does say false and Status does return 200. Let me know if I can provide you any additional information.
@ArkeBcacy Nothing that I’m aware of has changed in the service or client library. I’ll close this issue for now, but please let me know if you see this issue again.