Skip to content

Commit

Permalink
feat: hide localhost traffic
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiga1993 committed May 14, 2024
1 parent 5de214b commit 73fe3de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pollect/sources/K8sNamespaceTrafficSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ def __init__(self, config):
super().__init__(config)
self._namespace_label = config.get('namespaceLabel', 'namespace')
self._traffic_log_mode = config.get('trafficLog')
hide_localhost_traffic = config.get('hideLocalhostTraffic', True)

self.known_networks: List[NamedNetworks] = []
for network in config.get('networks', []):
name = network['name']
self.known_networks.append(NamedNetworks(name, network['cidrs']))

# Add catch-any as last item
self.known_networks.append(NamedNetworks('localhost', ['127.0.0.1'], hide=True))
self.known_networks.append(NamedNetworks('localhost', ['127.0.0.0/8'], hide=hide_localhost_traffic))
self.known_networks.append(NamedNetworks('other', ['0.0.0.0/0'], catch_all=True))
self._metrics = NamespacesMetrics(self.known_networks)

Expand Down

0 comments on commit 73fe3de

Please sign in to comment.