Toloka documentation

NewUserBonuses

toloka.metrics.metrics.NewUserBonuses | Source code

NewUserBonuses(
    self,
    count_name: Optional[str] = None,
    money_name: Optional[str] = None,
    join_events: bool = False,
    *,
    toloka_client: Optional[TolokaClient] = None,
    atoloka_client: Optional[AsyncTolokaClient] = None,
    timeout: timedelta = ...
)

Tracking rewards for Tolokers: reward count or money amount.

Parameters Description

Parameters Type Description
count_name Optional[str]

Metric name for a count of new bonuses.

money_name Optional[str]

Metric name for amount of money in new bonuses.

join_events bool

Count all events in one point. Default False.

Examples:

How to collect this metrics:

def print_metric(metric_dict):
    print(metric_dict)

collector = MetricCollector([NewUserBonuses(toloka_client=toloka_client)], print_metric)
asyncio.run(collector.run())
'bonus_count': [(datetime.datetime(2021, 11, 18, 8, 29, 9, 734373), 0)],
'bonus_money': [(datetime.datetime(2021, 11, 18, 8, 29, 9, 734377), Decimal('0'))]

}

Methods Summary

Method Description
get_line_names Returns a list of metric names that can be generated by this class instance.