Skip to content

Commit 3e89f44

Browse files
authored
fix(destination)!: replace ip_port_subscribers with workload_subscribers (#14612)
* fix(destination): drop ip and port metric labels The destination control's ip_port_subscriber and ip_port_updates metrics are potentailly exposed for every IP that is discovered. This is high cardinality and puts undo pressure on the metrics infrastructure. This change drops these labels, so that there is a single ip_port_subscriber and ip_port_updates timeseries. * rename metric to workload_subscribers
1 parent 08119c1 commit 3e89f44

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

controller/api/destination/watcher/workload_watcher.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"net"
7-
"strconv"
87
"strings"
98
"sync"
109
"time"
@@ -61,7 +60,7 @@ type (
6160
}
6261
)
6362

64-
var ipPortVecs = newMetricsVecs("ip_port", []string{"ip", "port"})
63+
var workloadVecs = newMetricsVecs("workload", []string{})
6564

6665
func NewWorkloadWatcher(k8sAPI *k8s.API, metadataAPI *k8s.MetadataAPI, log *logging.Entry, enableEndpointSlices bool, defaultOpaquePorts map[uint32]struct{}) (*WorkloadWatcher, error) {
6766
ww := &WorkloadWatcher{
@@ -455,10 +454,8 @@ func (ww *WorkloadWatcher) getOrNewWorkloadPublisher(service *ServiceID, hostnam
455454
ipPort := IPPort{ip, port}
456455
wp, ok := ww.publishers[ipPort]
457456
if !ok {
458-
metrics, err := ipPortVecs.newMetrics(prometheus.Labels{
459-
"ip": ip,
460-
"port": strconv.FormatUint(uint64(port), 10),
461-
})
457+
// Omit high-cardinality IP:port labels.
458+
metrics, err := workloadVecs.newMetrics(prometheus.Labels{})
462459
if err != nil {
463460
return nil, err
464461
}

0 commit comments

Comments
 (0)