mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-20 18:51:03 +02:00
Metrics working, better labelling structure
This commit is contained in:
parent
3c5f6edc54
commit
93a50ab218
2 changed files with 11 additions and 10 deletions
|
|
@ -26,7 +26,7 @@ class ConsumerMetrics:
|
|||
if not hasattr(__class__, "processing_metric"):
|
||||
__class__.processing_metric = Counter(
|
||||
'processing_count', 'Processing count',
|
||||
["processor", "flow", "name"],
|
||||
["processor", "flow", "name", "status"],
|
||||
)
|
||||
|
||||
if not hasattr(__class__, "rate_limit_metric"):
|
||||
|
|
@ -37,22 +37,23 @@ class ConsumerMetrics:
|
|||
|
||||
def process(self, status):
|
||||
__class__.processing_metric.labels(
|
||||
processor = self.processor, flow=self.flow, status=status
|
||||
processor = self.processor, flow = self.flow, name = self.name,
|
||||
status=status
|
||||
).inc()
|
||||
|
||||
def rate_limit(self):
|
||||
__class__.rate_limit_metric.labels(
|
||||
processor = self.processor, flow=self.flow
|
||||
processor = self.processor, flow = self.flow, name = self.name,
|
||||
).inc()
|
||||
|
||||
def state(self, state):
|
||||
__class__.state_metric.labels(
|
||||
processor = self.processor, flow=self.flow
|
||||
processor = self.processor, flow = self.flow, name = self.name,
|
||||
).state(state)
|
||||
|
||||
def record_time(self):
|
||||
return __class__.request_metric.labels(
|
||||
processor = self.processor, flow=self.flow
|
||||
processor = self.processor, flow = self.flow, name = self.name,
|
||||
).time()
|
||||
|
||||
class ProducerMetrics:
|
||||
|
|
@ -63,14 +64,14 @@ class ProducerMetrics:
|
|||
self.flow = flow
|
||||
self.name = name
|
||||
|
||||
if not hasattr(__class__, "output_metric"):
|
||||
__class__.output_metric = Counter(
|
||||
'output_count', 'Output items created',
|
||||
if not hasattr(__class__, "producer_metric"):
|
||||
__class__.producer_metric = Counter(
|
||||
'producer_count', 'Output items produced',
|
||||
["processor", "flow", "name"],
|
||||
)
|
||||
|
||||
def inc(self):
|
||||
__class__.output_metric.labels(
|
||||
__class__.producer_metric.labels(
|
||||
processor = self.processor, flow = self.flow, name = self.name
|
||||
).inc()
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class RequestResponseSpec(Spec):
|
|||
def add(self, flow, processor, definition):
|
||||
|
||||
producer_metrics = ProducerMetrics(
|
||||
process = flow.id, name = flow.name, name = self.response_name
|
||||
processor = flow.id, flow = flow.name, name = self.response_name
|
||||
)
|
||||
|
||||
rr = self.impl(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue