pobox
pobox copied to clipboard
Stats collection callback module
I want to implement a feature to collect data to generate statistics from the :pobox
. I was thinking of implementing this as a callback module. Do you have any thoughts or suggestions about this?
The information I want to collect:
- dropped messages
- delivered messages
- received messages
- clobbering events (push+drop for
:keep_old
buffers)? - others?
I would normally think that the metrics could be accumulated in the process that receives from the PO Box.
- dropped is returned
- delivered is returned
- received is delivered+dropped
- isn't clobbering the same as dropped?
But if you want them centralized, I think it could make sense to put them in the process dictionary on every delivery or at regular intervals. The thing the library should do is avoid doing too much work on every message to avoid falling behind reception. Values in the pdict could be read with process_info/2.
Yes sorry, I meant non-clobbering events, and yes they are the same as dropped in non-custom buffers (for custom think priority queue). Good idea with the pdict that could work well enough.
I will probably implement this after the heir/give_away feature, so we have time to iron out details.