tangled
alpha
login
or
join now
hailey.at
/
followgraph
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
add an insert counter metric
hailey.at
2 months ago
d697bcb3
f28f6a70
+11
2 changed files
expand all
collapse all
unified
split
indexer.py
metrics.py
+4
indexer.py
···
131
prom_metrics.insert_duration.labels(kind="follow", status=status).observe(
132
time() - start_time
133
)
0
134
135
def insert_unfollow(self, unfollow: Unfollow):
136
to_insert: Optional[List[Unfollow]] = None
···
166
finally:
167
prom_metrics.insert_duration.labels(kind="unfollow", status=status).observe(
168
time() - start_time
0
0
0
169
)
170
171
def flush_all(self):
···
131
prom_metrics.insert_duration.labels(kind="follow", status=status).observe(
132
time() - start_time
133
)
134
+
prom_metrics.inserted.labels(kind="follow", status=status).inc(len(follows))
135
136
def insert_unfollow(self, unfollow: Unfollow):
137
to_insert: Optional[List[Unfollow]] = None
···
167
finally:
168
prom_metrics.insert_duration.labels(kind="unfollow", status=status).observe(
169
time() - start_time
170
+
)
171
+
prom_metrics.inserted.labels(kind="unfollow", status=status).inc(
172
+
len(unfollows)
173
)
174
175
def flush_all(self):
+7
metrics.py
···
54
documentation="Time taken to insert a batch",
55
)
56
0
0
0
0
0
0
0
57
self._initialized = True
58
59
def start_http(self, port: int, addr: str = "0.0.0.0"):
···
54
documentation="Time taken to insert a batch",
55
)
56
57
+
self.inserted = Counter(
58
+
name="inserted",
59
+
namespace=NAMESPACE,
60
+
documentation="Number of items inserted",
61
+
labelnames=["kind", "status"],
62
+
)
63
+
64
self._initialized = True
65
66
def start_http(self, port: int, addr: str = "0.0.0.0"):