Skip to content

Commit

Permalink
feat(gazer): Tracked request exchanges between services
Browse files Browse the repository at this point in the history
  • Loading branch information
isala404 committed Feb 18, 2022
1 parent 562f72d commit 08aa053
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions gazer/gazer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
backlog = Gauge("backlog", "Request backlog", ["namespace", "serviceName", "podName", "level"])
cpu = Gauge("cpu_seconds", "CPU usage", ["namespace", "serviceName", "podName"])
memory = Gauge("memory_usage_bytes", "Memory usage", ["namespace", "serviceName", "podName"])
request_exchanges = Counter("request_exchanges", "Request exchanges between services", ["origin", "destination"])


class Gazer:
Expand Down Expand Up @@ -76,6 +77,7 @@ def ipv4_request_event(self, cpu, data, size):
if not rpod['isService']:
return
request_received.labels(rpod['namespace'], rpod['serviceName'], rpod['name']).inc()
request_exchanges.labels(pod['serviceName'], rpod['serviceName']).inc()

ms.labels(pod['namespace'], pod['serviceName'], pod['name']).observe(event['MS'] / 1000000)
tx_kb.labels(pod['namespace'], pod['serviceName'], pod['name']).observe(event['TX_KB'])
Expand Down Expand Up @@ -123,7 +125,8 @@ def poll_syn_backlog(self):
if saddr in config_watcher.config:
pod = config_watcher.config[saddr]

backlog.labels(pod['namespace'], pod['serviceName'], pod['name'], row[0].slot).set(row[1].value)
backlog.labels(pod['namespace'], pod['serviceName'], pod['name'], int(row[0].slot)).set(
int(row[1].value))

if self.console_mode:
self.syn_df = self.syn_df.append({
Expand Down Expand Up @@ -181,10 +184,3 @@ def poll_data_in_bg(self):
poll_syn_backlog.join()
poll_requests.join()
poll_kube_api.join()

def extract_number(text):
res = [int(i) for i in text.split() if i.isdigit()]
if len(res) == 1:
return int(res)
else:
return 0

0 comments on commit 08aa053

Please sign in to comment.