prometheus-kafka-adapter icon indicating copy to clipboard operation
prometheus-kafka-adapter copied to clipboard

there is no way to control partition strategy

Open daniel-garcia opened this issue 4 years ago • 1 comments

The kafka client used in this project uses kafka.PartitionAny. This strategy doesn't let the user control how the data is spread onto the partitions on the topic. As a result, writing downstream processes that are partition-based is hampered. For example, if I was writing an application that computed gauge from a counter or an alert based on the duration of some condition, the application would need to have a centralized state so that partition consumers could consult the historical state to evaluate the result. However, if the metrics were reliably hashed onto a partition, the consumers could be operated with consumer-specific state (or in-memory state).

daniel-garcia avatar Aug 27 '21 21:08 daniel-garcia

In addition to the use case mentioned, sending samples of a metric to multiple partitions can introduce out-of-order sample errors. With multiple partitions, there is no guarantee that messages will be consumed in order (this is only guaranteed for a partition, not across multiple partitions). To guarantee ordering of samples, all samples for a metric name+label set should go to the same partition. This is not the behavior of the current code with kafka.PartitionAny.

kd7lxl avatar Mar 06 '23 20:03 kd7lxl