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

Mutable NewConnectionProvider #3149

Closed
dimitaracev opened this issue Apr 11, 2024 · 10 comments
Closed

Mutable NewConnectionProvider #3149

dimitaracev opened this issue Apr 11, 2024 · 10 comments
Assignees
Labels
status/has-workaround This has a known workaround described

Comments

@dimitaracev
Copy link

Motivation

On a project that I'm currently working on, we need to export metrics to Prometheus and this is easily done for the PooledConnectionProvider through the ConnectionProvider.builder(..).metrics(true). We also use a NewConnectionProvider in certain situations where we always require new connections so no connection gets reused from the pool. Instantiating a ConnectionProvider through the ConnectionProvider.newConnection() method returns a NewConnectionProvider but unfortunately that implementation does not override the ConnectionProvider#mutate() method and instead returns the default null value. This means that there is no way to add metrics to this type of ConnectionProvider.

Desired solution

To be able to add metrics to a NewConnectionProvider, and the mutate method seems like a solution.

Considered alternatives

Creating our own NewConnectionProvider with a mutate method implemented, based on the one provided by Netty.

Additional context

Note: Happy to create a PR for this.

@dimitaracev dimitaracev added status/need-triage A new issue that still need to be evaluated as a whole type/enhancement A general enhancement labels Apr 11, 2024
@violetagg
Copy link
Member

@dimitaracev Can you please elaborate more? What kind of statistics do you need? Currently mutate is not implemented because it is not applicable for NewConnectionProvider, as it doesn't use a builder.

@violetagg violetagg removed the status/need-triage A new issue that still need to be evaluated as a whole label Apr 11, 2024
@violetagg violetagg self-assigned this Apr 11, 2024
@violetagg violetagg added the for/user-attention This issue needs user attention (feedback, rework, etc...) label Apr 11, 2024
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@dimitaracev
Copy link
Author

dimitaracev commented Apr 22, 2024

@violetagg Thanks for the response and sorry for the late reply. I basically just need to enable the metrics for the NewConnectionProvider just as one can with ConnectionProvider.builder().metrics(true). I'm currently using the default implementation for Metrics MicrometerPooledConnectionProviderMeterRegistrar when creating my own ConnectionProvider. I would be beneficial to have the same metrics when creating NewConnectionProvider.

Please let me know if this not understandable enough but in short, I just need to enable the default metrics for a NewConnectionProvider.

@violetagg violetagg removed for/user-attention This issue needs user attention (feedback, rework, etc...) status/need-feedback labels Apr 22, 2024
@violetagg
Copy link
Member

violetagg commented Apr 22, 2024

@dimitaracev Looking at these MicrometerPooledConnectionProviderMeterRegistrar, only total and active are related to this ConnectionProvider. Is that what you need?

@dimitaracev
Copy link
Author

Yes, that would be enough. I just mainly need to keep track of the active connections.

@violetagg
Copy link
Member

violetagg commented Apr 22, 2024

Then why don't you use .doOnConnected event and report your own metrics about active connections? With NewConnectionProvider, .doOnConnected will be emitted for every request.

@dimitaracev
Copy link
Author

I guess that would work but would still defer from the MicrometerPooledConnectionProviderMeterRegistrar which I would like to keep for both so they behave the same whether a NewConnectionProvider is used or not. I will try and see how the above suggestion would work. Thanks!

@violetagg
Copy link
Member

ok keep me posted for the results

@violetagg violetagg added the for/user-attention This issue needs user attention (feedback, rework, etc...) label Apr 22, 2024
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Copy link

github-actions bot commented May 7, 2024

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
@violetagg violetagg added status/has-workaround This has a known workaround described and removed type/enhancement A general enhancement for/user-attention This issue needs user attention (feedback, rework, etc...) status/need-feedback labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/has-workaround This has a known workaround described
Projects
None yet
Development

No branches or pull requests

2 participants