MetricCollector

toloka.metrics.collector.MetricCollector | Source code

MetricCollector(
self,
metrics: List[BaseMetric],
callback: Callable[[Dict[str, List[Tuple[Any, Any]]]], None]
)

Gather metrics

Examples:

How to gather metrics and sends it to zabbix:

import toloka.client as toloka
from toloka.metrics import MetricCollector, Balance, AssignmentsInPool
toloka_client = toloka.TolokaClient(token, 'PRODUCTION')
def send_metric_to_zabbix(metric_dict):
### do something
pass
collector = MetricCollector(
[
Balance(),
AssignmentsInPool('12345678'),
],
send_metric_to_zabbix,
)
bind_client(collector.metrics, toloka_client)
asyncio.run(collector.run())

Methods summary

MethodDescription
create_async_tasksNone
runStarts collecting metrics. And never stops.

Last updated: August 28, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming