Aggregator¶
- class kafkaaggregator.aggregator.Aggregator(configfile: Path, aggregated_topic: str)¶
Bases:
objectCreate the aggregation model and compute summary statistics.
Given a source topic and a list of field names to exclude from aggregation create the aggregation model and compute summary statistics.
kafka-aggregator adds the aggregation fields
time,window_size, andcountand computesmin,mean,stdev,median, andmaxstatistics for every numeric field in the source topic.- Parameters:
aggregated_topic (
str) – Name of the aggregated topic.config (
AggregatorConfig) – Aggregator configuration
Attributes Summary
Methods Summary
Sync call to
async create_record().compute(time, messages)Compute summary statistics for a list of messages.
Create a Faust-avro Record class for the aggregation topic.
Attributes Documentation
- logger = <Logger kafkaaggregator (WARNING)>¶
Methods Documentation
- async_create_record() Record¶
Sync call to
async create_record().Get the current event loop and call the async
create_record()method.- Returns:
record – Faust-avro Record class for the aggreation topic.
- Return type:
Record
- compute(time: float, messages: List[Any]) Record¶
Compute summary statistics for a list of messages.
- Parameters:
time (
float) – The timestamp of the aggregated message, typically the midpoint of the aggregation window.messages (
list) – List of messages from which to compute the summary statistics
- Returns:
aggregated_message – Aggregated message.
- Return type:
Record
- async create_record() Record¶
Create a Faust-avro Record class for the aggregation topic.
- Returns:
record – Faust-avro Record class for the aggreated topic.
- Return type:
Record