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

Include operationId on command monitoring events for bulkWrite

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.3.3
    • Component/s: Bulk API

      There are no operationId in APM logs.

      The spec requires operationId to be present for commands of bulkWrite operation.

       

      Code to reproduce:

      db.collection('test').bulkWrite([  { insertOne: { document: { a: 1 } } },  { insertOne: { document: { a: 2 } } },  { insertOne: { document: { a: 3 } } },]);// https://github.com/mongodb/node-mongodb-native/blob/20800ac/lib/bulk/common.js#L761-L762// was manually set to 2 for simplicity

       APM logs:

      [2020-02-18T17:22:56.201Z] commandStarted (module=mongo)
          command: {
            "command": {
              "insert": "test",
              "documents": [
                {
                  "a": 1,
                  "_id": "5e4c1d7034d1881a6066cad1"
                }
              ],
              "ordered": true,
              "lsid": {
                "id": "+ivqNA8sQ++RZhJ/+QkLyA=="
              },
              "txnNumber": "2",
              "$clusterTime": {
                "clusterTime": {
                  "$timestamp": "6794838304668778502"
                },
                "signature": {
                  "hash": "HLTxiSgvA9PVOOhCK7OctMxtDe8=",
                  "keyId": "6788086152222998946"
                }
              },
              "$db": "data"
            },
            "databaseName": "data",
            "commandName": "insert",
            "requestId": 3,
            "connectionId": "127.0.0.1:27017"
          }
      [2020-02-18T17:22:56.217Z] commandSucceeded (module=mongo)
          command: {
            "duration": 15.029695,
            "commandName": "insert",
            "reply": {
              "n": 1,
              "opTime": {
                "ts": {
                  "$timestamp": "6794838304668778503"
                },
                "t": 18
              },
              "electionId": "7fffffff0000000000000012",
              "ok": 1,
              "operationTime": {
                "$timestamp": "6794838304668778503"
              },
              "$clusterTime": {
                "clusterTime": {
                  "$timestamp": "6794838304668778503"
                },
                "signature": {
                  "hash": "HLTxiSgvA9PVOOhCK7OctMxtDe8=",
                  "keyId": "6788086152222998946"
                }
              }
            },
            "requestId": 3,
            "connectionId": "127.0.0.1:27017"
          }
      [2020-02-18T17:22:56.219Z] commandStarted (module=mongo)
          command: {
            "command": {
              "insert": "test",
              "documents": [
                {
                  "a": 2,
                  "_id": "5e4c1d7034d1881a6066cad2"
                }
              ],
              "ordered": true,
              "lsid": {
                "id": "+ivqNA8sQ++RZhJ/+QkLyA=="
              },
              "txnNumber": "3",
              "$clusterTime": {
                "clusterTime": {
                  "$timestamp": "6794838304668778503"
                },
                "signature": {
                  "hash": "HLTxiSgvA9PVOOhCK7OctMxtDe8=",
                  "keyId": "6788086152222998946"
                }
              },
              "$db": "data"
            },
            "databaseName": "data",
            "commandName": "insert",
            "requestId": 4,
            "connectionId": "127.0.0.1:27017"
          }
      [2020-02-18T17:22:56.231Z] commandSucceeded (module=mongo)
          command: {
            "duration": 10.872601,
            "commandName": "insert",
            "reply": {
              "n": 1,
              "opTime": {
                "ts": {
                  "$timestamp": "6794838304668778504"
                },
                "t": 18
              },
              "electionId": "7fffffff0000000000000012",
              "ok": 1,
              "operationTime": {
                "$timestamp": "6794838304668778504"
              },
              "$clusterTime": {
                "clusterTime": {
                  "$timestamp": "6794838304668778504"
                },
                "signature": {
                  "hash": "HLTxiSgvA9PVOOhCK7OctMxtDe8=",
                  "keyId": "6788086152222998946"
                }
              }
            },
            "requestId": 4,
            "connectionId": "127.0.0.1:27017"
          }
      [2020-02-18T17:22:56.232Z] commandStarted (module=mongo)
          command: {
            "command": {
              "insert": "test",
              "documents": [
                {
                  "a": 3,
                  "_id": "5e4c1d7034d1881a6066cad3"
                }
              ],
              "ordered": true,
              "lsid": {
                "id": "+ivqNA8sQ++RZhJ/+QkLyA=="
              },
              "txnNumber": "4",
              "$clusterTime": {
                "clusterTime": {
                  "$timestamp": "6794838304668778504"
                },
                "signature": {
                  "hash": "HLTxiSgvA9PVOOhCK7OctMxtDe8=",
                  "keyId": "6788086152222998946"
                }
              },
              "$db": "data"
            },
            "databaseName": "data",
            "commandName": "insert",
            "requestId": 5,
            "connectionId": "127.0.0.1:27017"
          }
      [2020-02-18T17:22:56.242Z] commandSucceeded (module=mongo)
          command: {
            "duration": 8.819815,
            "commandName": "insert",
            "reply": {
              "n": 1,
              "opTime": {
                "ts": {
                  "$timestamp": "6794838304668778505"
                },
                "t": 18
              },
              "electionId": "7fffffff0000000000000012",
              "ok": 1,
              "operationTime": {
                "$timestamp": "6794838304668778505"
              },
              "$clusterTime": {
                "clusterTime": {
                  "$timestamp": "6794838304668778505"
                },
                "signature": {
                  "hash": "HLTxiSgvA9PVOOhCK7OctMxtDe8=",
                  "keyId": "6788086152222998946"
                }
              }
            },
            "requestId": 5,
            "connectionId": "127.0.0.1:27017"
          }  

       

      There are still traces of operationId in the code, but it seems that it was broken in https://github.com/mongodb/node-mongodb-native/pull/1675.

            Assignee:
            Unassigned Unassigned
            Reporter:
            konanmentor@gmail.com Aliaksei Tuzik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: