File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,16 @@ def get_pricing_info(self) -> ActorPricingInfo:
64
64
This can be used for instance when your code needs to support multiple pricing models in transition periods.
65
65
"""
66
66
67
+ def get_charged_event_count (self , event_name : str ) -> int :
68
+ """Get the number of events with the given name that were charged so far.
69
+
70
+ Args:
71
+ event_name: Name of the inspected event.
72
+ """
73
+
74
+ def get_max_total_charge_usd (self ) -> Decimal :
75
+ """Get the configured maximum total charge for this Actor run."""
76
+
67
77
68
78
@docs_group ('Charging' )
69
79
@dataclass (frozen = True )
@@ -309,6 +319,15 @@ def get_pricing_info(self) -> ActorPricingInfo:
309
319
},
310
320
)
311
321
322
+ @ensure_context
323
+ def get_charged_event_count (self , event_name : str ) -> int :
324
+ item = self ._charging_state .get (event_name )
325
+ return item .charge_count if item is not None else 0
326
+
327
+ @ensure_context
328
+ def get_max_total_charge_usd (self ) -> Decimal :
329
+ return self ._max_total_charge_usd
330
+
312
331
313
332
@dataclass
314
333
class ChargingStateItem :
You can’t perform that action at this time.
0 commit comments