Skip to content

Commit

Permalink
RUST-1701 Log when CosmosDB or DocumentDB are detected (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
abr-egn authored Sep 19, 2023
1 parent 5a13fde commit 6a9ef26
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/client/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,29 @@ impl ClientOptions {
}
}

#[cfg(feature = "tracing-unstable")]
{
let hostnames = if let Some(info) = &self.original_srv_info {
vec![info.hostname.to_ascii_lowercase()]
} else {
self.hosts
.iter()
.filter_map(|addr| match addr {
ServerAddress::Tcp { host, .. } => Some(host.to_ascii_lowercase()),
_ => None,
})
.collect()
};
if hostnames.iter().any(|s| s.ends_with(".cosmos.azure.com")) {
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");
}
if hostnames.iter().any(|s| {
s.ends_with(".docdb.amazonaws.com") || s.ends_with(".docdb-elastic.amazonaws.com")
}) {
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");
}
}

Ok(())
}

Expand Down

0 comments on commit 6a9ef26

Please sign in to comment.