Guard VNI tooltip join against transient duplicate series

Wrap the group_left RHS in max by (device, vlan) so a Prometheus restart
or relabel change (old/new label-set series briefly coexisting in the
staleness window) can't trip PromQL's many-to-many matching error.

Closes #50
This commit is contained in:
2026-07-10 09:51:48 +00:00
parent b03464d0df
commit b726848da0
2 changed files with 8 additions and 2 deletions

View File

@@ -100,7 +100,7 @@
},
{
"refId": "D",
"expr": "count by (device, vlan) (network_instances_network_instance_fdb_mac_table_entries_entry_vlan{device=~\"campus-leaf1|campus-leaf2|campus-leaf3|campus-leaf4|dc-leaf1|dc-leaf2|dc-leaf5|dc-leaf6\"})\n* on(device, vlan) group_left(vlan_to_vni_state_vni)\ninterfaces_interface_arista_vxlan_vlan_to_vnis_vlan_to_vni_state_vni{device=~\"campus-leaf1|campus-leaf2|campus-leaf3|campus-leaf4|dc-leaf1|dc-leaf2|dc-leaf5|dc-leaf6\"}",
"expr": "count by (device, vlan) (network_instances_network_instance_fdb_mac_table_entries_entry_vlan{device=~\"campus-leaf1|campus-leaf2|campus-leaf3|campus-leaf4|dc-leaf1|dc-leaf2|dc-leaf5|dc-leaf6\"})\n* on(device, vlan) group_left(vlan_to_vni_state_vni)\nmax by (device, vlan) (interfaces_interface_arista_vxlan_vlan_to_vnis_vlan_to_vni_state_vni{device=~\"campus-leaf1|campus-leaf2|campus-leaf3|campus-leaf4|dc-leaf1|dc-leaf2|dc-leaf5|dc-leaf6\"})",
"legendFormat": "VNI {{device}} {{vlan}}",
"datasource": {
"type": "prometheus",

View File

@@ -352,12 +352,18 @@ def build_weathermap(devices, links, interface_speeds, positions, prometheus_url
if vtep_hosts:
vtep_regex = "|".join(promql_escape(h) for h in vtep_hosts)
# Verbatim join from #44 "VXLAN (MAC count per VNI)", scoped to VTEP nodes.
# RHS is wrapped in max by (device, vlan) so the join key is always
# unique -- a Prometheus restart or relabel change otherwise leaves
# the pre-restart (frozen) and post-restart series briefly coexisting
# within the 5m staleness window, both matching the same (device,
# vlan) group, which trips PromQL's "many-to-many matching not
# allowed" error. See #50.
targets.append({
"refId": "D",
"expr": (
f'count by (device, vlan) (network_instances_network_instance_fdb_mac_table_entries_entry_vlan{{device=~"{vtep_regex}"}})\n'
f'* on(device, vlan) group_left(vlan_to_vni_state_vni)\n'
f'interfaces_interface_arista_vxlan_vlan_to_vnis_vlan_to_vni_state_vni{{device=~"{vtep_regex}"}}'
f'max by (device, vlan) (interfaces_interface_arista_vxlan_vlan_to_vnis_vlan_to_vni_state_vni{{device=~"{vtep_regex}"}})'
),
"legendFormat": "VNI {{device}} {{vlan}}",
})