-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preparing for producer diagnostics #1452
base: master
Are you sure you want to change the base?
Conversation
85249b2
to
36bfae6
Compare
Hint for the reviewer: enable 'hide whitespace' to minimize the diff. |
It has been a long wish to have producer diagnostics. Although these are not really hard to add, the consumer diagnostics are a bit in the way; these already claim some names and make code sharing awkward. Now that we are moving towards zio-kafka 3.0 we can fix these at the cost of some backward incompatibilities. This PR prepares for the introduction of producer diagnostics by moving the consumer diagnostics specific code out of the diagnostics package, while keeping the sharable code there. The following changes are proposed (fixable with scalafix): | Old | New | | --- | --- | | `zio.kafka.consumer.diagnostics.Diagnostics` | `zio.kafka.consumer.Consumer.ConsumerDiagnostics` | | `zio.kafka.consumer.diagnostics.Diagnostics.NoOp` | `zio.kafka.consumer.Consumer.NoDiagnostics` | | `zio.kafka.consumer.diagnostics.DiagnosticEvent` | `zio.kafka.consumer.ConsumerDiagnosticEvent` | | `zio.kafka.consumer.diagnostics.DiagnosticEvent.*` | `zio.kafka.consumer.ConsumerDiagnosticEvent.*` | | `zio.kafka.consumer.diagnostics.DiagnosticEvent.Finalization.*` | `zio.kafka.consumer.ConsumerDiagnosticEvent.*` | Different invocation: old: `zio.kafka.consumer.diagnostics.Diagnostics.SligingQueue.make()` new: `zio.kafka.diagnostics.SlidingDiagnostics.make[ConsumerDiagnosticEvent]()` Move to internal or test package: | Old | New | New location | | --- | --- | --- | | `zio.kafka.consumer.diagnostics.Diagnostics.ConcurrentDiagnostics` | `zio.kafka.diagnostics.internal.ConcurrentDiagnostics` | internal | | `zio.kafka.consumer.diagnostics.DiagnosticEvent.Finalization` | removed | - | Notes: - The intermediate trait `DiagnosticEvent.Finalization` was removed from the type hierarchy because it doesn't serve any user purpose (it was introduced to make it easier to test the shutdown sequence of the consumer).
36bfae6
to
636aab0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a review. Just two suggestions if they are applicable.
zio-kafka/src/main/scala/zio/kafka/diagnostics/internal/ConcurrentDiagnostics.scala
Show resolved
Hide resolved
I can see the use in generalizing SlidingDiagnostics and ConcurrentDiagnostics by parameterizing them with the type of diagnostic event. But I'd like to see if we can keep the rest of the stuff in the same package and with the same name, just to minimize changes. What would be the downside of having |
One downside is that its very annoying when you have a scala file that needs both classes. |
It has been a long wish to have producer diagnostics. Although these are not really hard to add, the consumer diagnostics are a bit in the way; these already claim some names and make code sharing awkward. Now that we are moving towards zio-kafka 3.0 we can fix these at the cost of some backward incompatibilities.
This PR prepares for the introduction of producer diagnostics by moving the consumer diagnostics specific code out of the diagnostics package, while keeping the sharable code there.
The following changes are proposed (fixable with scalafix):
zio.kafka.consumer.diagnostics.Diagnostics
zio.kafka.consumer.Consumer.ConsumerDiagnostics
zio.kafka.consumer.diagnostics.Diagnostics.NoOp
zio.kafka.consumer.Consumer.NoDiagnostics
zio.kafka.consumer.diagnostics.DiagnosticEvent
zio.kafka.consumer.ConsumerDiagnosticEvent
zio.kafka.consumer.diagnostics.DiagnosticEvent.*
zio.kafka.consumer.ConsumerDiagnosticEvent.*
zio.kafka.consumer.diagnostics.DiagnosticEvent.Finalization.*
zio.kafka.consumer.ConsumerDiagnosticEvent.*
Different invocation:
old:
zio.kafka.consumer.diagnostics.Diagnostics.SligingQueue.make()
new:
zio.kafka.diagnostics.SlidingDiagnostics.make[ConsumerDiagnosticEvent]()
Move to internal or test package:
zio.kafka.consumer.diagnostics.Diagnostics.ConcurrentDiagnostics
zio.kafka.diagnostics.internal.ConcurrentDiagnostics
zio.kafka.consumer.diagnostics.DiagnosticEvent.Finalization
Notes:
DiagnosticEvent.Finalization
was removed from the type hierarchy because it doesn't serve any user purpose (it was introduced to make it easier to test the shutdown sequence of the consumer).