Skip to content

Commit 828f313

Browse files
authored
Merge pull request #235338 from yossi-y/main
Removed ambiguity in cross query
2 parents 1b95cc5 + 0cf90e5 commit 828f313

File tree

3 files changed

+21
-34
lines changed

3 files changed

+21
-34
lines changed

articles/azure-monitor/logs/app-expression.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The app expression is used in an Azure Monitor log query to retriev
44
ms.topic: conceptual
55
author: bwren
66
ms.author: bwren
7-
ms.date: 08/06/2022
7+
ms.date: 04/20/2023
88

99
---
1010

@@ -26,42 +26,34 @@ The `app` expression is used in an Azure Monitor query to retrieve data from a s
2626

2727
| Identifier | Description | Example
2828
|:---|:---|:---|
29-
| Resource Name | Human readable name of the app (Also known as "component name") | app("fabrikamapp") |
30-
| Qualified Name | Full name of the app in the form: "subscriptionName/resourceGroup/componentName" | app('AI-Prototype/Fabrikam/fabrikamapp') |
31-
| ID | GUID of the app | app("988ba129-363e-4415-8fe7-8cbab5447518") |
32-
| Azure Resource ID | Identifier for the Azure resource |app("/subscriptions/7293b69-db12-44fc-9a66-9c2005c3051d/resourcegroups/Fabrikam/providers/microsoft.insights/components/fabrikamapp") |
29+
| ID | GUID of the app | app("00000000-0000-0000-0000-000000000000") |
30+
| Azure Resource ID | Identifier for the Azure resource |app("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/Fabrikam/providers/microsoft.insights/components/fabrikamapp") |
3331

3432

3533
## Notes
3634

3735
* You must have read access to the application.
38-
* Identifying an application by its name assumes that it is unique across all accessible subscriptions. If you have multiple applications with the specified name, the query will fail because of the ambiguity. In this case you must use one of the other identifiers.
36+
* Identifying an application by its ID or Azure Resource ID is strongly recommended since unique, removes ambiguity, and more performant.
3937
* Use the related expression [workspace](../logs/workspace-expression.md) to query across Log Analytics workspaces.
4038

4139
## Examples
4240

4341
```Kusto
44-
app("fabrikamapp").requests | count
42+
app("00000000-0000-0000-0000-000000000000").requests | count
4543
```
4644
```Kusto
47-
app("AI-Prototype/Fabrikam/fabrikamapp").requests | count
48-
```
49-
```Kusto
50-
app("b438b4f6-912a-46d5-9cb1-b44069212ab4").requests | count
51-
```
52-
```Kusto
53-
app("/subscriptions/7293b69-db12-44fc-9a66-9c2005c3051d/resourcegroups/Fabrikam/providers/microsoft.insights/components/fabrikamapp").requests | count
45+
app("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/Fabrikam/providers/microsoft.insights/components/fabrikamapp").requests | count
5446
```
5547
```Kusto
5648
union
57-
(workspace("myworkspace").Heartbeat | where Computer contains "Con"),
58-
(app("myapplication").requests | where cloud_RoleInstance contains "Con")
49+
(workspace("00000000-0000-0000-0000-000000000000").Heartbeat | where Computer == "myComputer"),
50+
(app("00000000-0000-0000-0000-000000000000").requests | where cloud_RoleInstance == "myColumnInstance")
5951
| count
6052
```
6153
```Kusto
6254
union
63-
(workspace("myworkspace").Heartbeat), (app("myapplication").requests)
64-
| where TimeGenerated between(todatetime("2018-02-08 15:00:00") .. todatetime("2018-12-08 15:05:00"))
55+
(workspace("00000000-0000-0000-0000-000000000000").Heartbeat), (app("00000000-0000-0000-0000-000000000000").requests)
56+
| where TimeGenerated between(todatetime("2023-03-08 15:00:00") .. todatetime("2023-04-08 15:05:00"))
6557
```
6658

6759
## Next steps

articles/azure-monitor/logs/query-optimization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Optimized queries will:
2222
- Run faster and reduce overall duration of the query execution.
2323
- Have smaller chance of being throttled or rejected.
2424

25-
Pay particular attention to queries that are used for recurrent and bursty usage, such as dashboards, alerts, Azure Logic Apps, and Power BI. The impact of an ineffective query in these cases is substantial.
25+
Pay particular attention to queries that are used for recurrent and simultaneous usage, such as dashboards, alerts, Azure Logic Apps, and Power BI. The impact of an ineffective query in these cases is substantial.
2626

2727
Here's a detailed video walkthrough on optimizing queries.
2828

@@ -455,7 +455,7 @@ A query that spans more than five workspaces is considered a query that consumes
455455

456456
> [!IMPORTANT]
457457
> - In some multi-workspace scenarios, the CPU and data measurements won't be accurate and will represent the measurement of only a few of the workspaces.
458-
> - Cross workspace queries having an explicit identifier: workspace ID, or workspace Resource Manager resource ID, consume less resources and are more performant. See [Create a log query across multiple workspaces](./cross-workspace-query.md#identify-workspace-resources)
458+
> - Cross workspace queries having an explicit identifier: workspace ID, or workspace Azure Resource ID, consume less resources and are more performant. See [Create a log query across multiple workspaces](./cross-workspace-query.md#identify-workspace-resources)
459459
460460
## Parallelism
461461
Azure Monitor Logs uses large clusters of Azure Data Explorer to run queries. These clusters vary in scale and potentially get up to dozens of compute nodes. The system automatically scales the clusters according to workspace placement logic and capacity.

articles/azure-monitor/logs/workspace-expression.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The workspace expression is used in an Azure Monitor log query to r
44
ms.topic: conceptual
55
author: bwren
66
ms.author: bwren
7-
ms.date: 08/06/2022
7+
ms.date: 04/20/2023
88

99
---
1010

@@ -23,38 +23,33 @@ The `workspace` expression is used in an Azure Monitor query to retrieve data fr
2323

2424
| Identifier | Description | Example
2525
|:---|:---|:---|
26-
| Resource Name | Human readable name of the workspace (also known as "component name") | workspace("contosoretail") |
27-
| Qualified Name | Full name of the workspace in the form: "subscriptionName/resourceGroup/componentName" | workspace('Contoso/ContosoResource/ContosoWorkspace') |
28-
| ID | GUID of the workspace | workspace("b438b3f6-912a-46d5-9db1-b42069242ab4") |
29-
| Azure Resource ID | Identifier for the Azure resource | workspace("/subscriptions/e4227-645-44e-9c67-3b84b5982/resourcegroups/ContosoAzureHQ/providers/Microsoft.OperationalInsights/workspaces/contosoretail") |
26+
| ID | GUID of the workspace | workspace("00000000-0000-0000-0000-000000000000") |
27+
| Azure Resource ID | Identifier for the Azure resource | workspace("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/Contoso/providers/Microsoft.OperationalInsights/workspaces/contosoretail") |
3028

3129

3230
## Notes
3331

3432
* You must have read access to the workspace.
33+
* Identifying a workspace by its ID or Azure Resource ID is strongly recommended since unique, removes ambiguity, and more performant.
3534
* A related expression is `app` that allows you to query across Application Insights applications.
3635

3736
## Examples
3837

3938
```Kusto
40-
workspace("contosoretail").Update | count
39+
workspace("00000000-0000-0000-0000-000000000000").Update | count
4140
```
4241
```Kusto
43-
workspace("b438b4f6-912a-46d5-9cb1-b44069212ab4").Update | count
44-
```
45-
```Kusto
46-
workspace("/subscriptions/e427267-5645-4c4e-9c67-3b84b59a6982/resourcegroups/ContosoAzureHQ/providers/Microsoft.OperationalInsights/workspaces/contosoretail").Event | count
42+
workspace("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/Contoso/providers/Microsoft.OperationalInsights/workspaces/contosoretail").Event | count
4743
```
4844
```Kusto
4945
union
50-
(workspace("myworkspace").Heartbeat | where Computer contains "Con"),
51-
(app("myapplication").requests | where cloud_RoleInstance contains "Con")
46+
( workspace("00000000-0000-0000-0000-000000000000").Heartbeat | where Computer == "myComputer"),
47+
(app("00000000-0000-0000-0000-000000000000").requests | where cloud_RoleInstance == "myRoleInstance")
5248
| count
5349
```
5450
```Kusto
5551
union
56-
(workspace("myworkspace").Heartbeat), (app("myapplication").requests)
57-
| where TimeGenerated between(todatetime("2018-02-08 15:00:00") .. todatetime("2018-12-08 15:05:00"))
52+
(workspace("00000000-0000-0000-0000-000000000000").Heartbeat), (app("00000000-0000-0000-0000-000000000000").requests) | where TimeGenerated between(todatetime("2023-03-08 15:00:00") .. todatetime("2023-04-08 15:05:00"))
5853
```
5954

6055
## Next steps

0 commit comments

Comments
 (0)