fix(go.d/nats): add missing cid label to gw charts (#19311)
Ilya Mashchenko committed
Jan 2, 2025 at 13:14 UTC
e5857f3295a1e918a2c17c13b29f2792575a4b61
1 file changed
+6
-5
src/go/plugin/go.d/collector/nats/charts.go
+6
-5
@@ -667,9 +667,9 @@ func (c *Collector) addServerCharts() {
667
668
for _, chart := range *charts {
669
chart.Labels = []module.Label{
670
+ {Key: "cluster_name", Value: c.srvMeta.clusterName},
671
{Key: "server_id", Value: c.srvMeta.id},
672
{Key: "server_name", Value: c.srvMeta.name},
672
- {Key: "cluster_name", Value: c.srvMeta.clusterName},
673
}
674
}
675
@@ -684,9 +684,9 @@ func (c *Collector) addAccountCharts(acc *accCacheEntry) {
684
for _, chart := range *charts {
685
chart.ID = fmt.Sprintf(chart.ID, acc.accName)
686
chart.Labels = []module.Label{
687
+ {Key: "cluster_name", Value: c.srvMeta.clusterName},
688
{Key: "server_id", Value: c.srvMeta.id},
689
{Key: "server_name", Value: c.srvMeta.name},
689
- {Key: "cluster_name", Value: c.srvMeta.clusterName},
690
{Key: "account", Value: acc.accName},
691
}
692
for _, dim := range chart.Dims {
@@ -710,9 +710,9 @@ func (c *Collector) addRouteCharts(route *routeCacheEntry) {
710
for _, chart := range *charts {
711
chart.ID = fmt.Sprintf(chart.ID, route.rid)
712
chart.Labels = []module.Label{
713
+ {Key: "cluster_name", Value: c.srvMeta.clusterName},
714
{Key: "server_id", Value: c.srvMeta.id},
715
{Key: "server_name", Value: c.srvMeta.name},
715
- {Key: "cluster_name", Value: c.srvMeta.clusterName},
716
{Key: "route_id", Value: strconv.FormatUint(route.rid, 10)},
717
{Key: "remote_id", Value: route.remoteId},
718
}
@@ -744,11 +744,12 @@ func (c *Collector) addGatewayConnCharts(gwConn *gwConnCacheEntry, isInbound boo
744
chart.Title = fmt.Sprintf(chart.Title, cases.Title(language.English, cases.Compact).String(direction))
745
chart.Ctx = fmt.Sprintf(chart.Ctx, direction)
746
chart.Labels = []module.Label{
747
+ {Key: "cluster_name", Value: c.srvMeta.clusterName},
748
{Key: "server_id", Value: c.srvMeta.id},
749
{Key: "server_name", Value: c.srvMeta.name},
749
- {Key: "cluster_name", Value: c.srvMeta.clusterName},
750
{Key: "gateway", Value: gwConn.gwName},
751
{Key: "remote_gateway", Value: gwConn.rgwName},
752
+ {Key: "cid", Value: strconv.FormatUint(gwConn.cid, 10)},
753
}
754
for _, dim := range chart.Dims {
755
dim.ID = fmt.Sprintf(dim.ID, direction, gwConn.rgwName, gwConn.cid)
@@ -776,9 +777,9 @@ func (c *Collector) addLeafCharts(leaf *leafCacheEntry) {
777
chart.ID = fmt.Sprintf(chart.ID, leaf.leafName, leaf.account, leaf.ip, leaf.port)
778
chart.ID = cleanChartID(chart.ID)
779
chart.Labels = []module.Label{
780
+ {Key: "cluster_name", Value: c.srvMeta.clusterName},
781
{Key: "server_id", Value: c.srvMeta.id},
782
{Key: "server_name", Value: c.srvMeta.name},
781
- {Key: "cluster_name", Value: c.srvMeta.clusterName},
783
{Key: "remote_name", Value: leaf.leafName},
784
{Key: "account", Value: leaf.account},
785
{Key: "ip", Value: leaf.ip},