Skip to content

Commit 6a9ef26

Browse files
authored
RUST-1701 Log when CosmosDB or DocumentDB are detected (#958)
1 parent 5a13fde commit 6a9ef26

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/client/options.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,29 @@ impl ClientOptions {
14211421
}
14221422
}
14231423

1424+
#[cfg(feature = "tracing-unstable")]
1425+
{
1426+
let hostnames = if let Some(info) = &self.original_srv_info {
1427+
vec![info.hostname.to_ascii_lowercase()]
1428+
} else {
1429+
self.hosts
1430+
.iter()
1431+
.filter_map(|addr| match addr {
1432+
ServerAddress::Tcp { host, .. } => Some(host.to_ascii_lowercase()),
1433+
_ => None,
1434+
})
1435+
.collect()
1436+
};
1437+
if hostnames.iter().any(|s| s.ends_with(".cosmos.azure.com")) {
1438+
tracing::info!("You appear to be connected to a CosmosDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/cosmosdb");
1439+
}
1440+
if hostnames.iter().any(|s| {
1441+
s.ends_with(".docdb.amazonaws.com") || s.ends_with(".docdb-elastic.amazonaws.com")
1442+
}) {
1443+
tracing::info!("You appear to be connected to a DocumentDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/documentdb");
1444+
}
1445+
}
1446+
14241447
Ok(())
14251448
}
14261449

0 commit comments

Comments
 (0)