Detects external database hosts and logs an informational message at the INFO level.
(entity: str)
| 3056 | |
| 3057 | |
| 3058 | def _detect_external_db(entity: str) -> bool: |
| 3059 | """Detects external database hosts and logs an informational message at the INFO level.""" |
| 3060 | entity = entity.lower() |
| 3061 | cosmos_db_hosts = [".cosmos.azure.com"] |
| 3062 | document_db_hosts = [".docdb.amazonaws.com", ".docdb-elastic.amazonaws.com"] |
| 3063 | |
| 3064 | for host in cosmos_db_hosts: |
| 3065 | if entity.endswith(host): |
| 3066 | _log_or_warn( |
| 3067 | _CLIENT_LOGGER, |
| 3068 | "You appear to be connected to a CosmosDB cluster. For more information regarding feature " |
| 3069 | "compatibility and support please visit https://www.mongodb.com/supportability/cosmosdb", |
| 3070 | ) |
| 3071 | return True |
| 3072 | for host in document_db_hosts: |
| 3073 | if entity.endswith(host): |
| 3074 | _log_or_warn( |
| 3075 | _CLIENT_LOGGER, |
| 3076 | "You appear to be connected to a DocumentDB cluster. For more information regarding feature " |
| 3077 | "compatibility and support please visit https://www.mongodb.com/supportability/documentdb", |
| 3078 | ) |
| 3079 | return True |
| 3080 | return False |
| 3081 | |
| 3082 | |
| 3083 | if _HAS_REGISTER_AT_FORK: |
no test coverage detected