TL;DR: Bare regex matchers like pod=~”foo” will soon return only exact matches, not substring matches. If you rely on =~ for “starts with” or “contains” semantics, update your queries to add .* before the change lands.
What is changing
AMW’s Prometheus Query Service is moving to fully-anchored regex matching, aligning with the upstream Prometheus specification.
After the change, every =~ and !~ matcher is wrapped with ^…$ before evaluation. This matches the behavior of self-hosted Prometheus, Grafana Cloud Metrics, and Amazon Managed Prometheus.
“Regex matches are fully anchored. A match of env=~”foo” is treated as env=~”^foo$”.”
Reference: Prometheus querying basics — Instant vector selectors
Behavior delta
Given these timeseries:
kube_pod_container_status_ready{pod=”grafana-otel-collector-97b6c55f4-abc12″}
kube_pod_container_status_ready{pod=”grafana-otel-collector-97b6c55f4-def34″}
kube_pod_container_status_ready{pod=”grafana-otel-collector-97b6c55f4″}
Query:
kube_pod_container_status_ready{pod=~”grafana-otel-collector-97b6c55f4″}
|
Environment |
Effective regex |
Series returned |
|
AMW PQS — current |
grafana-otel-collector-97b6c55f4 (unanchored) |
3 (all matching pods) |
|
AMW PQS — after change |
^grafana-otel-collector-97b6c55f4$ |
1 (exact name only) |
|
Self-hosted Prometheus, Grafana Cloud, AMP |
^grafana-otel-collector-97b6c55f4$ |
1 (exact name only) |
If your query depends on the first row, it will return fewer — often zero — series after the change.
What to do
Audit any query, alert rule, recording rule, or dashboard variable that uses =~ or !~. Map each to the table below.
|
Intent |
Update to |
|
Exact match |
No change necessary; both label=“value” and label=~”value” should return exact matches after updating query engine version for fully anchored regex support. |
|
Starts with |
label=~”value.*“ |
|
Ends with |
label=~“.*value” |
|
Contains |
label=~“.*value.*“ |
|
Set of prefixes |
label=~”(a\|b\|c).*“ |
Recommendation: Where the intent is exact match, switch from =~ to =
It is clearer to readers and skips per-series regex evaluation.
When ready, update AMW configuration to use the latest Query engine version. This can be done via the Azure Portal UI, Azure CLI, or PowerShell.
Configuring AMW to use the latest Prometheus query engine version
Azure Portal
- In the Azure portal, open your Azure Monitor workspace.
- Under Settings, select Properties.
- Select the Latest segment of the Query engine version for the AMW.
Azure CLI
Run the following command to update to the latest (2.0) metrics query engine version for the AMW:
Az monitor account metrics-container update –subscription <subscriptionId> -g <resourcegroupName> -w <azmonWorkspaceName> -n default –version 2.0
Azure PowerShell
Run the following command to use the latest Query engine version for the AMW:
$resourceId = “/subscriptions/<subscriptionId>/resourceGroups/<resourcegroupName>/providers/Microsoft.Monitor/accounts/<azureMonitorWorkspaceName>/metricsContainers/default”
Az resource update
–ids $resourceId
–api-version 2025-10-03
–set properties.version=2.0
–force-string
To confirm:
Az resource show
–ids $resourceId
–api-version 2025-10-03
–query properties.version
–output tsv
Expected output: 2.0
Common pitfalls
- Alternation anchors the whole expression. pod=~”foo|bar“ becomes ^(?:foo|bar)$, not ^foo|bar$. Add .* and parentheses for prefix sets.
- . matches any character, including –. pod=~”my-pod.*“ will match my-pod-xyz, my-podxyz, and my-pod9xyz. Use character classes like [-] for tighter matches.
- Empty-label matching is unchanged. label=~”“ still matches series without that label.
Timeline
- Public Preview rollout: September 2026
- In Public Preview, newly created AMWs will default to the latest metrics query version (“2.0”) which features fully anchored regex matching.
- AMWs created prior to September 2026 will continue using version (“1.0”) unless users take action to update. This provides users with the opportunity to verify their query intent and update accordingly prior to cutover to the latest AMW metrics query engine version.
- General Availability: March 2027
- In General Availability, all AMWs regardless of creation date will be updated to version “2.0” for cross-workspace compatibility.
- Action window: Audit and update queries before the General Availability date.


