You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "codeconsole (via GitHub)" <gi...@apache.org> on 2026/06/05 04:03:28 UTC
[PR] Add MongoClientSettingsBuilderCustomizer hook for the Mongo client [grails-core]
codeconsole opened a new pull request, #15716:
URL: https://github.com/apache/grails-core/pull/15716
## What
Adds a `MongoClientSettingsBuilderCustomizer` extension point to GORM for MongoDB. Any beans of this type in the application context are applied, in order, to the `MongoClientSettings.Builder` of the default connection source before the `MongoClient` is created.
## Why
There is currently no supported way to customize `MongoClientSettings` for things that have no `grails.mongodb.*` configuration equivalent — most notably registering a driver `com.mongodb.event.CommandListener` for metrics/tracing (e.g. Micrometer's `MongoMetricsCommandListener`), but also programmatic connection-pool tuning, read/write concerns, etc. Today that requires replacing the datastore wiring.
Mirrors Spring Boot's `MongoClientSettingsBuilderCustomizer` of the same name, giving GORM-MongoDB users the same ergonomics.
## How
- New functional interface `org.grails.datastore.mapping.mongo.connections.MongoClientSettingsBuilderCustomizer`.
- `MongoConnectionSourceFactory` gains an `@Autowired(required = false) List<MongoClientSettingsBuilderCustomizer>` applied in `create()` just before `MongoClients.create(...)`. The factory is already registered with `bean.autowire = true` in `MongoDbDataStoreSpringInitializer`, so customizer beans are injected automatically. No behavior change when none are defined.
## Example
```groovy
@Bean
MongoClientSettingsBuilderCustomizer mongoMetrics(MeterRegistry registry) {
return { builder -> builder.addCommandListener(new MongoMetricsCommandListener(registry)) }
}
```
## Tests
Added to `MongoConnectionSourceFactorySpec`:
- a registered customizer is applied, and its command listener lands in the built settings
- multiple customizers run in registration order
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add MongoClientSettingsBuilderCustomizer hook for the Mongo client [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on PR #15716:
URL: https://github.com/apache/grails-core/pull/15716#issuecomment-4628784281
> @codeconsole Can this target 8? Decided in the weekly meeting May 27th, point 1, 7.x.x is not accepting new features. Focus should now be on 8+.
@matrei done, how about a review ;P
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add MongoClientSettingsBuilderCustomizer hook for the Mongo client [grails-core]
Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #15716:
URL: https://github.com/apache/grails-core/pull/15716#issuecomment-4628574644
@codeconsole Can this target 8?
Decided in the weekly meeting May 27th, point 1, 7.x.x is not accepting new features.
Focus should now be on 8+.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add MongoClientSettingsBuilderCustomizer hook for the Mongo client [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15716:
URL: https://github.com/apache/grails-core/pull/15716#issuecomment-4628426319
## ✅ All tests passed ✅
🏷️ Commit: 22bab600bd2b20c38fa09336e8a338d1f1989bee
▶️ Tests: 45687 executed
⚪️ Checks: 37/37 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add MongoClientSettingsBuilderCustomizer hook for the Mongo client [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole merged PR #15716:
URL: https://github.com/apache/grails-core/pull/15716
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add MongoClientSettingsBuilderCustomizer hook for the Mongo client [grails-core]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #15716:
URL: https://github.com/apache/grails-core/pull/15716#issuecomment-4633743074
## [Codecov](https://app.codecov.io/gh/apache/grails-core/pull/15716?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `50.00000%` with `1 line` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 48.3694%. Comparing base ([`098660a`](https://app.codecov.io/gh/apache/grails-core/commit/098660ad3ceea412bd8b25eb1bb19ebf6aecd441?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d37eba7`](https://app.codecov.io/gh/apache/grails-core/commit/d37eba786ec06ef88dac456538159ce3be36bc8c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on 8.0.x.
| [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/15716?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...go/connections/MongoConnectionSourceFactory.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15716?src=pr&el=tree&filepath=grails-data-mongodb%2Fcore%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fdatastore%2Fmapping%2Fmongo%2Fconnections%2FMongoConnectionSourceFactory.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWRhdGEtbW9uZ29kYi9jb3JlL3NyYy9tYWluL2dyb292eS9vcmcvZ3JhaWxzL2RhdGFzdG9yZS9tYXBwaW5nL21vbmdvL2Nvbm5lY3Rpb25zL01vbmdvQ29ubmVjdGlvblNvdXJjZUZhY3RvcnkuZ3Jvb3Z5) | 50.0000% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/15716?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/grails-core/pull/15716?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## 8.0.x #15716 +/- ##
==================================================
- Coverage 48.3729% 48.3694% -0.0035%
- Complexity 15108 15109 +1
==================================================
Files 1870 1870
Lines 85457 85459 +2
Branches 14900 14901 +1
==================================================
- Hits 41338 41336 -2
- Misses 37784 37785 +1
- Partials 6335 6338 +3
```
| [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/15716?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...go/connections/MongoConnectionSourceFactory.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15716?src=pr&el=tree&filepath=grails-data-mongodb%2Fcore%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fdatastore%2Fmapping%2Fmongo%2Fconnections%2FMongoConnectionSourceFactory.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWRhdGEtbW9uZ29kYi9jb3JlL3NyYy9tYWluL2dyb292eS9vcmcvZ3JhaWxzL2RhdGFzdG9yZS9tYXBwaW5nL21vbmdvL2Nvbm5lY3Rpb25zL01vbmdvQ29ubmVjdGlvblNvdXJjZUZhY3RvcnkuZ3Jvb3Z5) | `60.7143% <50.0000%> (-0.8242%)` | :arrow_down: |
... and [2 files with indirect coverage changes](https://app.codecov.io/gh/apache/grails-core/pull/15716/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org