Skip to content

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

Merged
merged 4 commits into from
Jun 16, 2025

Conversation

rozza
Copy link
Member

@rozza rozza commented Jun 11, 2025

As well as add Topology events to structured logging

JAVA-5229

@rozza rozza requested a review from Copilot June 11, 2025 14:49
Copy link

@Copilot Copilot AI left a 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 and ContextElement to assert topology events and map cluster events to topology* types.
  • Introduce structured logging calls (logTopologyOpening, logTopologyDescriptionChanged, logTopologyClosedEvent) and new TOPOLOGY 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(

As well as add Topology events to structured logging

JAVA-5229
@rozza rozza marked this pull request as ready for review June 12, 2025 11:32
@rozza rozza requested review from a team and NathanQingyangXu and removed request for a team June 12, 2025 11:33
Copy link
Contributor

@NathanQingyangXu NathanQingyangXu left a 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.

@rozza rozza requested a review from NathanQingyangXu June 16, 2025 09:17
@rozza rozza merged commit a20d204 into mongodb:main Jun 16, 2025
52 of 54 checks passed
@rozza rozza deleted the JAVA-5229 branch June 16, 2025 14:27
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

Successfully merging this pull request may close these issues.

2 participants