|
15 | 15 | rx_kb = Histogram("acknowledged_bytes", "Number of received bytes during TCP event",
|
16 | 16 | ["namespace", "serviceName", "podName"])
|
17 | 17 | request_sent = Counter("requests_sent", "Total request sent", ["namespace", "serviceName", "podName"])
|
18 |
| -request_received = Counter("request_received", "Total request received", ["namespace", "serviceName", "podName"]) |
| 18 | +request_received = Counter("requests_received", "Total request received", ["namespace", "serviceName", "podName"]) |
19 | 19 | backlog = Gauge("backlog", "Request backlog", ["namespace", "serviceName", "podName", "level"])
|
20 | 20 | cpu = Gauge("cpu_seconds", "CPU usage", ["namespace", "serviceName", "podName"])
|
21 | 21 | memory = Gauge("memory_usage_bytes", "Memory usage", ["namespace", "serviceName", "podName"])
|
@@ -70,18 +70,20 @@ def ipv4_request_event(self, cpu, data, size):
|
70 | 70 | if event['LADDR'] in config_watcher.config:
|
71 | 71 | pod = config_watcher.config[event['LADDR']]
|
72 | 72 |
|
| 73 | + if event['RADDR'] in config_watcher.config: |
| 74 | + rpod = config_watcher.config[event['RADDR']] |
| 75 | + if not rpod['isService']: |
| 76 | + return |
| 77 | + request_received.labels(rpod['namespace'], rpod['serviceName'], rpod['name']).inc() |
| 78 | + |
73 | 79 | ms.labels(pod['namespace'], pod['serviceName'], pod['name']).observe(event['MS'] / 1000000)
|
74 | 80 | tx_kb.labels(pod['namespace'], pod['serviceName'], pod['name']).observe(event['TX_KB'])
|
75 | 81 | rx_kb.labels(pod['namespace'], pod['serviceName'], pod['name']).observe(event['RX_KB'])
|
76 | 82 | request_sent.labels(pod['namespace'], pod['serviceName'], pod['name']).inc()
|
77 | 83 |
|
78 |
| - if event['RADDR'] in config_watcher.config: |
79 |
| - rpod = config_watcher.config[event['RADDR']] |
80 |
| - request_received.labels(rpod['namespace'], rpod['serviceName'], pod['name']).inc() |
81 |
| - |
82 | 84 | if self.console_mode:
|
83 | 85 | self.request_df = self.request_df.append(event, ignore_index=True)
|
84 |
| - self.request_df = self.request_df[-25:] |
| 86 | + self.request_df = self.request_df[-10:] |
85 | 87 |
|
86 | 88 | def poll_requests(self):
|
87 | 89 | while True:
|
@@ -159,7 +161,7 @@ def syn_backlog_text(self):
|
159 | 161 | def request_log_text(self):
|
160 | 162 | if self.request_df.empty:
|
161 | 163 | return ""
|
162 |
| - return self.request_df.tail(25).__str__() |
| 164 | + return self.request_df.tail(10).__str__() |
163 | 165 |
|
164 | 166 | def poll_data_in_bg(self):
|
165 | 167 | poll_syn_backlog = threading.Thread(target=self.poll_syn_backlog, args=())
|
|
0 commit comments