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

Make consumer metric collection more configurable #1153

Open
erikvanoosten opened this issue Jan 21, 2024 · 3 comments
Open

Make consumer metric collection more configurable #1153

erikvanoosten opened this issue Jan 21, 2024 · 3 comments

Comments

@erikvanoosten
Copy link
Collaborator

erikvanoosten commented Jan 21, 2024

PR #1143 introduces the new trait ConsumerMetrics. We see opportunity to increase the number of metric use cases by allowing users to plug in their own implementations.

These use cases come to mind:

  • Change the histogram boundaries. This could be supported by allowing users to override the histogram boundaries in the current implementation, ZioConsumerMetrics (the boundaries are declared as protected so overriding is already possible).
  • Use of a completely different metrics backend, e.g. Dropwizard metrics or Micrometer. This could be supported by allowing users to provide their own implementation of ConsumerMetrics.

One problem that needs to be solved is that trait ConsumerMetrics uses the completely internal type Runloop.State. The type Runloop.State has moved around and changed many times in zio-kafka's history. Something that is possible because it is an internal private type. Exposing Runloop.State is therefore not attractive.

A possible solution:

  • Move the trait ConsumerMetrics to the zio.kafka.consumer.metrics package.
  • In the trait, replace the parameter of type Runloop.State with something that does not expose internal types.
  • Allow users to provide their own implementation via ConsumerSettings.

Considerations

  • It is not yet established whether any user needs the flexibility proposed in this issue.
  • Other parts of zio-kafka (producer api, admin api) do not collect metrics yet. Any solution has to be scalable to those parts as well.
@svroonland
Copy link
Collaborator

My vote is for option 2, exposing a new type State-like type dedicated for metrics.

@erikvanoosten
Copy link
Collaborator Author

My vote is for option 2, exposing a new type State-like type dedicated for metrics.

There is only 1 proposal consisting of 3 points :)

@svroonland
Copy link
Collaborator

D'oh 😅 I guess I need some caffeine first.

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

No branches or pull requests

2 participants