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 tolokafrom toloka.metrics import MetricCollector, Balance, AssignmentsInPooltoloka_client = toloka.TolokaClient(token, 'PRODUCTION')def send_metric_to_zabbix(metric_dict): ### do something passcollector = MetricCollector( [ Balance(), AssignmentsInPool('12345678'), ], send_metric_to_zabbix,)bind_client(collector.metrics, toloka_client)asyncio.run(collector.run())
Method | Description |
---|---|
create_async_tasks | None |
run | Starts collecting metrics. And never stops. |