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

No metrics are bound for R2DBC ConnectionPools that have been wrapped #30090

Closed
guerricmerleHUG opened this issue Mar 7, 2022 · 4 comments
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@guerricmerleHUG
Copy link

guerricmerleHUG commented Mar 7, 2022

spring boot 2.6.4, spring data r2dbc and pgsql, prometheus metrics activated,
There is no metric for connection pool.
if i debug ConnectionPoolMetricsAutoConfiguration, i see that
if (connectionFactory instanceof ConnectionPool) return always false.

So no ConnectionPoolMetrics created

image

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 7, 2022
@wilkinsona
Copy link
Member

wilkinsona commented Mar 7, 2022

Something's proxied the ConnectionPool so that we can no longer tell that's what it is. We may be able to unwrap it (io.r2dbc.spi.Wrapped.unwrap()) but it's impossible to tell without knowing more. Can you please share a complete, yet minimal example that reproduces the problem? You can do so by zipping it up and attaching it to this issue or pushing it to a separate repository on GitHub.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Mar 7, 2022
@hongjunan
Copy link

thank you, i solved this problem

bean {
    ConnectionPoolMetrics((ref() as Wrapped<ConnectionPool>).unwrap(), "r2dbc", emptyList())
        .bindTo(ref())
}

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 8, 2022
@wilkinsona
Copy link
Member

That looks like a good workaround. We should be able to do that automatically for you in our metrics auto-configuration.

@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Mar 8, 2022
@wilkinsona wilkinsona added this to the 2.5.x milestone Mar 8, 2022
@wilkinsona wilkinsona changed the title No metrics in prometheus for r2dbc connection pool No metrics are bound for R2DBC ConnectionPools that have been wrapped Mar 8, 2022
@wilkinsona wilkinsona self-assigned this Mar 8, 2022
@wilkinsona wilkinsona modified the milestones: 2.5.x, 2.5.11 Mar 8, 2022
@guerricmerleHUG
Copy link
Author

Thanks you for your reactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants