Skip to content

Conversation

@slayful
Copy link
Contributor

@slayful slayful commented Apr 23, 2018

Proposed Changes

See #354.

Types of Changes

  • Bugfix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

This is currently a WIP.

@slayful slayful changed the title #354 | Metrics for ack, nack & unrouted publishes WIP #354 | Metrics for ack, nack & unrouted publishes Apr 23, 2018
@acogoluegnes acogoluegnes self-requested a review April 24, 2018 14:48
@slayful
Copy link
Contributor Author

slayful commented Apr 24, 2018

@acogoluegnes this lacks tests, but can be considered complete if you ignore multiple (n)acks.

To support multiple (n)acks I'll create a separate PR. Would it possible to merge naive implementation w/o multiple confirms?

  • delivery tag is incrementing for each message sent
  • the broker can (n)ack a single message or multiple up til a specified delivery tag
  • acks don't necessarily come in the same order

Possible implementation is to track ranges of acked or nacked messages and update the counters, in the following fashion:
1 ack -> [1:ack]
3 ack -> [1:ack, 3:ack]
2 ack -> [1-3ack]
4 nack -> [1-3ack, 4nack]
7 ack -> [1-3ack, 4nack, ?-7ack]
5 ack -> [1-3ack, 4nack, 5ack, ?-7ack]
6 ack -> [1-3ack, 4nack, 5-7ack]

When sufficient (higher than timeout for waiting for (n)ack) has elapsed, then possibly the structure can be simplified into just counters for nacks and acks plus the structure above for the newer ones. That would optimise for memory.

How's that sound for a solution?

@slayful slayful mentioned this pull request Apr 25, 2018
11 tasks
Copy link
Contributor

@acogoluegnes acogoluegnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add at least a test case with publisher confirms in the Metrics integration test. It can be a sunny test, with only publishing acknowledgments, publishing nack are hard to simulate. The fact multiple ack aren't handled shouldn't be a problem.

@acogoluegnes
Copy link
Contributor

@slayful I'm not sure I'm following you on the multiple ack/nack support. But, yes, it can wait another PR, as long as the item in my review is addressed.
Going back to the multiple ack/nack support, note the delivery tags are channel-scoped, so you need to maintain a state for each channel. There's already such a state for handle delivery ack in AbstractMetricsCollector. Note also all this bookkeeping should be done only if the channel has enabled publisher confirm, another information to hold in the channel state.

@acogoluegnes
Copy link
Contributor

@slayful Any update on this? The PR has still "WIP" in its title and a couple of comments to address, so I'm wondering.

@slayful
Copy link
Contributor Author

slayful commented May 15, 2018

Sorry, I was a little bit busier than usually. I should be able to address the feedback within this week. :)

@slayful
Copy link
Contributor Author

slayful commented Jun 2, 2018

I have yet to fix the test for unrouted messages, but when I do it should be ready for a second review.

@slayful slayful changed the title WIP #354 | Metrics for ack, nack & unrouted publishes #354 | Metrics for ack, nack & unrouted publishes Jun 3, 2018
@acogoluegnes
Copy link
Contributor

@slayful Thanks for this contribution! @michaelklishin Any comments before merging?

@michaelklishin
Copy link
Contributor

@acogoluegnes I think it's good to go.

1 similar comment
@michaelklishin
Copy link
Contributor

@acogoluegnes I think it's good to go.

@acogoluegnes acogoluegnes merged commit b248a7a into rabbitmq:master Jun 4, 2018
@slayful slayful deleted the rabbitmq-java-354-ack-nack-unrouted branch June 4, 2018 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants