[JAVA-4732] Ensure toString methods of events containing a connection id also include the server and cluster id Created: 22/Sep/22  Updated: 28/Oct/23  Resolved: 03/Oct/22

Status: Closed
Project: Java Driver
Component/s: Monitoring
Affects Version/s: None
Fix Version/s: 4.8.0

Type: Improvement Priority: Unknown
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed

 Description   

The toString methods of connection pool and server heartbeat event classes (and perhaps others) include a call to ConnectionId#toString, but while ConnectiondId has a ServerId property, it's not included. As a result, if applications log these events by calling toString, they won't see the host names, which makes it kind of useless, e.g. from a recent support case:

 
2022-09-14 02:09:42.402 Received ServerHeartbeatStartedEvent: ServerHeartbeatStartedEvent{connectionId=connectionId{localValue:11, serverValue:173309}} 

We should update either ConnectionId#toString or *Event#toString to include the host name/port and perhaps the cluster id as well.



 Comments   
Comment by Githook User [ 03/Oct/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add server address and cluster id to events' toString output (#1008)

JAVA-4732
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/33c1dcacf7ea03f480afc8d717e61a640fb4f0f0

Generated at Thu Feb 08 09:02:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.