-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Publish ClusterDescriptionChangedEvent on topology close #1738
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for publishing and structured logging of topology lifecycle events (opening, description changed, closed) and updates the unified SDAM tests to separate and validate these new topology events.
- Un-skip existing unified tests for topology events and implement separation of topology vs SDAM events in
UnifiedTest.java
. - Extend
EventMatcher
andContextElement
to assert topology events and map cluster events totopology*
types. - Introduce structured logging calls (
logTopologyOpening
,logTopologyDescriptionChanged
,logTopologyClosedEvent
) and newTOPOLOGY
component in the logging layer.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
UnifiedTestModifications.java | Re-enable previously skipped topology-emitting SDAM tests |
UnifiedTest.java | Separate topology and SDAM events; add TOPOLOGY_EVENT_NAMES and assertions |
EventMatcher.java | Add assertTopologyEventsEquality and update getEventType to map cluster events |
ContextElement.java | New context elements and serializers for topology events |
LogMessage.java | Add TOPOLOGY component and related entry names for structured logging |
LoadBalancedCluster.java | Emit and log ClusterClosedEvent as topology closed event |
BaseCluster.java | Publish topology opening/changed/closed events and structured logs |
ClusterOpeningEvent.java, ClusterDescriptionChangedEvent.java, ClusterClosedEvent.java | Javadoc updates to clarify synonymous “Topology” terminology |
Comments suppressed due to low confidence (1)
driver-core/src/main/com/mongodb/internal/connection/BaseCluster.java:635
- The new structured logging methods (
logTopologyOpening
,logTopologyDescriptionChanged
,logTopologyClosedEvent
) should be covered by unit tests to ensure the logging output remains correct over time.
static void logTopologyOpening(
driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTest.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/unified/ContextElement.java
Show resolved
Hide resolved
As well as add Topology events to structured logging JAVA-5229
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall great!
with some minor details to improve.
driver-sync/src/test/functional/com/mongodb/client/unified/ContextElement.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/unified/EventMatcher.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/unified/EventMatcher.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTest.java
Outdated
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTest.java
Show resolved
Hide resolved
driver-core/src/test/unit/com/mongodb/internal/connection/TestClusterListener.java
Show resolved
Hide resolved
driver-sync/src/test/functional/com/mongodb/client/unified/ContextElement.java
Outdated
Show resolved
Hide resolved
…ntMatcher.java Co-authored-by: Nathan Xu <[email protected]>
…fiedTest.java Co-authored-by: Nathan Xu <[email protected]>
As well as add Topology events to structured logging
JAVA-5229