Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5452

Log informational message client-side based on detected environment (DocumentDB or CosmosDB)

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0
    • Affects Version/s: None
    • Component/s: None
    • 3
    • 2
    • Hide

      DRIVERS-2583:
      Drivers should detect Cosmos and DocumentDB servers by examining host names added to a topology during MongoClient construction. If SRV is used, this check should be done on the SRV URI's `{hostname}.{domainname}` prior to SRV lookup (ex: xyz.mongodb.net).

      If one or more host names end with ".cosmos.azure.com" (case-insensitive), log the following message using an "info" level:

      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 one or more host names end with ".docdb.amazonaws.com" or ".docdb-elastic.amazonaws.com" (case-insensitive), log the following message using an "info" level:

      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

      Drivers should not emit more than one log message per MongoClient construction.

      Note: there are no spec/prose tests for this ticket. Each driver should implement its own set of tests for this behavior. The libmongoc tests from mongodb/mongo-c-driver#1374 may be used as a reference.
      Note#2: Refer to DRIVERS-2753 if using standardized logging.

      Show
      DRIVERS-2583: Drivers should detect Cosmos and DocumentDB servers by examining host names added to a topology during MongoClient construction. If SRV is used, this check should be done on the SRV URI's `{hostname}.{domainname}` prior to SRV lookup (ex: xyz.mongodb.net). If one or more host names end with ".cosmos.azure.com" (case-insensitive), log the following message using an "info" level: 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 one or more host names end with ".docdb.amazonaws.com" or ".docdb-elastic.amazonaws.com" (case-insensitive), log the following message using an "info" level: 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 Drivers should not emit more than one log message per MongoClient construction. Note: there are no spec/prose tests for this ticket. Each driver should implement its own set of tests for this behavior. The libmongoc tests from mongodb/mongo-c-driver#1374 may be used as a reference. Note#2: Refer to DRIVERS-2753 if using standardized logging.
    • Not Needed
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      This ticket was split from DRIVERS-2583, please see that ticket for a detailed description.

      AC

      • Consult existing drivers implementations to see exactly how standardized logging is used to log this message / which component
        • done prior to updating below AC
      • Detect Cosmos and DocumentDB servers through hostname string suffix matching at client construction time
        • host names matching:
          • end with the matching string 
          • be case insensitive 
        • check for SRV case as well 
      • Use standardized logging to log message at an info level, component set to 'client'
      • Only log only once client message at construction 
      • Add 'client' to MongoLoggableComponents enum 

      Testing

      • Unit test against a hostname with Cosmos or Document DB server patterns
        • Ensure case insensitivity
        • Ensure that the messages are logged to the client component
        • Test with SRV string and non-SRV strings log cases and non-log (genuine host) cases

            Assignee:
            aditi.khare@mongodb.com Aditi Khare
            Reporter:
            dbeng-pm-bot PM Bot
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: