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

use consistent identifiers in monitoring events to ensure traceability

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • None

      Today I wanted to use command monitoring to prove that a command was sent to a secondary, so I thought I'd so something like:

      const client = new MongoClient(..., { monitorCommands: true });
      
      const bag = [];
      client.on('commandStarted', filterForCommands(['count'], bag));
      await client.connect();
      await client.collection.find().count();
      
      const td = client.topology.description;
      const sd = td.servers.get(bag[0].address);
      ...

       

      Except this doesn't work for me on localhost because the TopologyDescription has all the servers listed by their seed names (localhost:31000, localhost:31001, localhost:31002) but the command monitoring event uses a resolved address of the connection (127.0.0.1:31002).

      We should ensure that people can trace commands consistently across all of our events.

            Assignee:
            Unassigned Unassigned
            Reporter:
            matt.broadstone@mongodb.com Matt Broadstone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: