From 940f54c553e3abfa38ac02759a393bdd8a33cf06 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 19 May 2026 01:14:05 -0700 Subject: [PATCH] Fix BGP Peer Map blank node graph: numeric edge mainstat The node graph rendered empty because the edges target returned a string mainstat ('iBGP'/'eBGP'). Grafana's nodeGraph treats edge mainStat as numeric for layout/labelling; a string value silently breaks the layout so no nodes are drawn (the working LS map and the original ls_topo both cast edge mainstat to an integer). Edge mainstat is now COUNT(DISTINCT feed)::int (BMP peer-feed count for the router pair); the iBGP/eBGP label moves to secondarystat and detail__session_type, which accept strings. Co-Authored-By: Claude Opus 4.7 (1M context) --- obmp-grafana/dashboards/obmp/Maps-1006/bgp_peer_map.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obmp-grafana/dashboards/obmp/Maps-1006/bgp_peer_map.json b/obmp-grafana/dashboards/obmp/Maps-1006/bgp_peer_map.json index 5ec8ec2..87ff3cf 100644 --- a/obmp-grafana/dashboards/obmp/Maps-1006/bgp_peer_map.json +++ b/obmp-grafana/dashboards/obmp/Maps-1006/bgp_peer_map.json @@ -31,7 +31,7 @@ { "datasource": {"type": "postgres","uid": "obmp_postgres"}, "format": "table", - "rawSql": "WITH rid AS (\n SELECT DISTINCT router_hash_id, host(localbgpid) AS bgpid\n FROM v_peers WHERE localbgpid IS NOT NULL\n),\nsess AS (\n SELECT DISTINCT\n LEAST(vp.router_hash_id, rid2.router_hash_id)::text AS a,\n GREATEST(vp.router_hash_id, rid2.router_hash_id)::text AS b,\n CASE WHEN vp.peerasn = vp.localasn THEN 'iBGP' ELSE 'eBGP' END AS kind\n FROM v_peers vp\n JOIN rid rid2 ON rid2.bgpid = host(vp.peerbgpid)\n WHERE vp.peer_state = 'up' AND vp.router_hash_id <> rid2.router_hash_id\n)\nSELECT a || '-' || b AS id, a AS source, b AS target,\n MAX(kind) AS mainstat, MAX(kind) AS detail__session_type\nFROM sess GROUP BY a, b", + "rawSql": "WITH rid AS (\n SELECT DISTINCT router_hash_id, host(localbgpid) AS bgpid\n FROM v_peers WHERE localbgpid IS NOT NULL\n),\nsess AS (\n SELECT\n LEAST(vp.router_hash_id, rid2.router_hash_id)::text AS a,\n GREATEST(vp.router_hash_id, rid2.router_hash_id)::text AS b,\n CASE WHEN vp.peerasn = vp.localasn THEN 'iBGP' ELSE 'eBGP' END AS kind,\n vp.peer_hash_id AS feed\n FROM v_peers vp\n JOIN rid rid2 ON rid2.bgpid = host(vp.peerbgpid)\n WHERE vp.peer_state = 'up' AND vp.router_hash_id <> rid2.router_hash_id\n)\nSELECT a || '-' || b AS id, a AS source, b AS target,\n COUNT(DISTINCT feed)::int AS mainstat,\n MAX(kind) AS secondarystat,\n MAX(kind) AS detail__session_type\nFROM sess GROUP BY a, b", "refId": "edges" } ],