-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compute best practices documentation update #1088
base: dev
Are you sure you want to change the base?
Conversation
|
||
### Query: AKS Cluster | ||
### List of cost recommendations for Compute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to track "Advisor" as a service under every category? It feels like that should only fall under General, right? At least, unless we see some very targeted action that we can recommend based on the service-specific queries, right?
| where tostring (properties.category) has "Cost" | ||
| where properties.shortDescription.problem has "underutilized" | ||
| where properties.impactedField has "Compute" or properties.impactedField has "Container" or properties.impactedField has "Web" | ||
| project AffectedResource=tostring(properties.resourceMetadata.resourceId),Impact=properties.impact,resourceGroup,AdditionaInfo=properties.extendedProperties,subscriptionId,Recommendation=tostring(properties.shortDescription.problem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be spaces around =
, after commas, and long lines should be broken up on multiple lines.
|
||
<h4>Category</h4> | ||
|
||
Resource management | ||
Cost optimization | ||
|
||
<h4>Query</h4> | ||
|
||
```kql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We should establish some KQL language standards. If you happen to know of any, we should document them in the wiki. No worries if you haven't.
AKSname = name | ||
advisorresources | ||
| where type == "microsoft.advisor/recommendations" | ||
| where tostring (properties.category) has "Cost" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| where tostring (properties.category) has "Cost" | |
| where tostring(properties.category) has "Cost" |
| where type == "microsoft.advisor/recommendations" | ||
| where tostring (properties.category) has "Cost" | ||
| where properties.shortDescription.problem has "underutilized" | ||
| where properties.impactedField has "Compute" or properties.impactedField has "Container" or properties.impactedField has "Web" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move each or
to a new line so it's more readable online. Web should be in the Web category and not in Compute according to FOCUS service categories.
| where properties.impactedField has "Compute" or properties.impactedField has "Container" or properties.impactedField has "Web" | |
| where properties.impactedField has "Compute" | |
or properties.impactedField has "Container" |
Resources | where type == "microsoft.compute/virtualmachines" | ||
| extend osDiskId= tostring(properties.storageProfile.osDisk.managedDisk.id) | ||
| join kind=leftouter(resources | ||
| where type =~ 'microsoft.compute/disks' | ||
| where properties !has 'Unattached' | ||
| where properties has 'osType' | ||
| project OS = tostring(properties.osType), osSku = tostring(sku.name), osDiskSizeGB = toint(properties.diskSizeGB), osDiskId=tostring(id)) on osDiskId | ||
| join kind=leftouter(Resources | ||
| where type =~ 'microsoft.compute/disks' | ||
| where properties !has "osType" | ||
| where properties !has 'Unattached' | ||
| project sku = tostring(sku.name), diskSizeGB = toint(properties.diskSizeGB), id = managedBy | ||
| summarize sum(diskSizeGB), count(sku) by id, sku) on id | ||
| project vmId=id, subscriptionId, resourceGroup, OS, location, osDiskId, osSku, osDiskSizeGB, DataDisksGB=sum_diskSizeGB, diskSkuCount=count_sku | ||
| sort by diskSkuCount desc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Make sure the queries are formatted correctly.
- You're using a case-insensitive type filter on some lines and case-sensitive on the first where. Which is correct?
- Let's always use single instead of double quotes.
- Make sure table names are cased consistently. You have "resources" and "Resources".
- Doesn't KQL use
order by
instead ofsort by
?
Resources | where type == "microsoft.compute/virtualmachines" | |
| extend osDiskId= tostring(properties.storageProfile.osDisk.managedDisk.id) | |
| join kind=leftouter(resources | |
| where type =~ 'microsoft.compute/disks' | |
| where properties !has 'Unattached' | |
| where properties has 'osType' | |
| project OS = tostring(properties.osType), osSku = tostring(sku.name), osDiskSizeGB = toint(properties.diskSizeGB), osDiskId=tostring(id)) on osDiskId | |
| join kind=leftouter(Resources | |
| where type =~ 'microsoft.compute/disks' | |
| where properties !has "osType" | |
| where properties !has 'Unattached' | |
| project sku = tostring(sku.name), diskSizeGB = toint(properties.diskSizeGB), id = managedBy | |
| summarize sum(diskSizeGB), count(sku) by id, sku) on id | |
| project vmId=id, subscriptionId, resourceGroup, OS, location, osDiskId, osSku, osDiskSizeGB, DataDisksGB=sum_diskSizeGB, diskSkuCount=count_sku | |
| sort by diskSkuCount desc | |
Resources | |
| where type == 'microsoft.compute/virtualmachines' | |
| extend osDiskId= tostring(properties.storageProfile.osDisk.managedDisk.id) | |
| join kind=leftouter( | |
Resources | |
| where type =~ 'microsoft.compute/disks' | |
| where properties !has 'Unattached' | |
| where properties has 'osType' | |
| project | |
OS = tostring(properties.osType), | |
osSku = tostring(sku.name), | |
osDiskSizeGB = toint(properties.diskSizeGB), | |
osDiskId=tostring(id) | |
) on osDiskId | |
| join kind=leftouter( | |
Resources | |
| where type =~ 'microsoft.compute/disks' | |
| where properties !has "osType" | |
| where properties !has 'Unattached' | |
| project | |
sku = tostring(sku.name), | |
diskSizeGB = toint(properties.diskSizeGB), | |
id = managedBy | |
| summarize sum(diskSizeGB), count(sku) by id, sku | |
) on id | |
| project | |
vmId = id, | |
subscriptionId, | |
resourceGroup, | |
OS, | |
location, | |
osDiskId, | |
osSku, | |
osDiskSizeGB, | |
DataDisksGB = sum_diskSizeGB, | |
diskSkuCount = count_sku | |
| order by diskSkuCount desc |
@@ -152,6 +174,87 @@ resources | |||
|
|||
<br> | |||
|
|||
### Query: Virtual machine scale set details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be in the VMSS section? (Unless I missed it.)
|
||
<br> | ||
|
||
## App Service plans |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to the Web category.
|
||
<br> | ||
|
||
## Azure Kubernetes Service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this back to the top. Services should be sorted alphabetically.
Co-authored-by: Michael Flanakin <[email protected]>
π οΈ Description
This update to the documentation page introduces new queries designed to retrieve detailed information about compute resources. The motivation behind these changes is to provide users with the tools needed to identify cost-saving opportunities and optimize resource usage. By leveraging these queries, users can gain insights into their compute resource allocation, enabling more efficient and cost-effective management.
π· Screenshots
π Checklist
π¬ How did you test this change?
πββοΈ Do any of the following that apply?
π Did you update
docs/changelog.md
?π Did you update documentation?