Hi ,
Thanks for reaching out to Microsoft Q&A.
The reason why filtering and splitting are disabled for your custom metric (numUsed
) in Azure Metrics Explorer is likely due to how custom metrics are structured and ingested into Application Insights. Here’s what’s happening and how to resolve it:
Understanding Why Filtering/Splitting is Disabled
Custom Metrics in Metrics Explorer Need Dimensions
- Azure Metrics Explorer supports filtering and splitting only if the custom metric is ingested with dimensions at the time of tracking.
- A custom dimension (like
computerName
) added viaTelemetryClient.Context.Properties
is only available in Log Analytics, not as a native metric dimension.
- When you add `computerName` as a common property, it does not make it a first-class metric dimension. - Metrics Explorer can only filter/split on dimensions that were included when tracking the metric.
- A custom dimension (like
Solution: Send computerName
as a Dimension
To allow filtering/splitting in Metrics Explorer, you need to send computerName
as a dimension when tracking the metric.
Step 1: Modify How You Send the Metric
Instead of using TelemetryClient.TrackMetric(name, value)
, use MetricIdentifier
and dimensions.
Step 2: Validate in Metrics Explorer
- Wait for 5-10 minutes after deployment.
- Go to Azure Portal > Application Insights > Metrics Explorer.
- Select the
numUsed
metric and check ifcomputerName
appears under "Split By".
Alternative: Use KQL (If You Stick With Logs)
If you want to continue using KQL, you can achieve similar results with this query:
customMetrics | where name == "numUsed" | extend instanceId = tostring(customDimensions["computerName"]) | summarize avg(numUsed) by bin(timestamp, 1m), instanceId | render timechart
Note:
- If the metric appears in Log Analytics with
computerName
but not in Metrics Explorer, it meanscomputerName
was not sent as a metric dimension. - Once sent correctly, filtering and splitting in Metrics Explorer should work without needing KQL.
Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.