Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

erikvanoosten
Copy link
Collaborator

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.*

Move to internal or test package:

Old New New location
zio.kafka.consumer.diagnostics.Diagnostics.SligingQueue zio.kafka.utils.SlidingDiagnostics[ConsumerDiagnostics] zio-kafka-tests
zio.kafka.consumer.diagnostics.Diagnostics.ConcurrentDiagnostics zio.kafka.diagnostics.internal.ConcurrentDiagnostics internal
zio.kafka.consumer.diagnostics.DiagnosticEvent.Finalization removed -

Notes:

  • We can decide to keep SligingQueue public.
  • 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).

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.*` |

Move to internal or test package:

| Old | New | New location |
| --- | --- | --- |
| `zio.kafka.consumer.diagnostics.Diagnostics.SligingQueue` | `zio.kafka.utils.SlidingDiagnostics[ConsumerDiagnostics]` | zio-kafka-tests |
| `zio.kafka.consumer.diagnostics.Diagnostics.ConcurrentDiagnostics` | `zio.kafka.diagnostics.internal.ConcurrentDiagnostics` | internal |
| `zio.kafka.consumer.diagnostics.DiagnosticEvent.Finalization` | removed | - |

Notes:

- We can decide to keep `SligingQueue` public.
- 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).
@erikvanoosten erikvanoosten added this to the 3.0.0 milestone Feb 5, 2025
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.

1 participant