Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1144

Implement SDAM Monitoring spec

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • None

      An enhancement to the APM implementation.

      Here's how to get started. First, understand how I did the Command Monitoring implementation (CDRIVER-769), which is a precursor to this feature and has a very similar implementation to this one.

      Now read https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring-monitoring.rst

      Now do similar work for SDAM Monitoring. Add to mongoc-apm.h and .c:

      • Events: mongoc_apm_server_changed_t, mongoc_apm_server_opening_t, mongoc_apm_server_closed_t, mongoc_apm_topology_changed_t, mongoc_apm_topology_opening_t, mongoc_apm_topology_closed_t, mongoc_apm_server_heartbeat_started_t, mongoc_apm_server_heartbeat_succeeded_t, mongoc_apm_server_heartbeat_failed_t.
      • Make event-field accessors for these 9 event structs: mongoc_apm_server_changed_get_address and so on. About 20 functions in all.
      • Typedef the 9 callback function pointer types: mongoc_apm_server_changed_cb_t, mongoc_apm_server_opening_cb_t, mongoc_apm_server_closed_cb_t, mongoc_apm_cb_topology_changed_cb_t, mongoc_apm_cb_topology_opening_cb_t, mongoc_apm_cb_topology_closed_cb_t, mongoc_apm_server_heartbeat_started_cb_t, mongoc_apm_server_heartbeat_succeeded_cb_t, mongoc_apm_server_heartbeat_failed_cb_t
      • Add 9 function pointers to _mongoc_apm_callbacks_t: _mongoc_apm_callbacks_t.server_changed, etc.
      • Make 9 callback registrar functions: mongoc_apm_set_server_changed_cb, etc.
      • Add mongoc_apm_callbacks_t* apm_callbacks field to topology description and server description.

      Start testing and implementing the events.

      • Adapt test-mongoc-command-monitoring.c for the SDAM Monitoring events.
      • Copy the JSON tests from the specs repo.
      • Disable all test asserts except for mongoc_apm_server_changed_t, then implement that event in mongoc_server_description_handle_ismaster?
      • Enable test asserts for mongoc_apm_server_opening_t, implement in mongoc_topology_description_add_server.
      • Enable test asserts for mongoc_apm_server_closed_t, implement in _mongoc_topology_description_remove_server.
      • Enable test asserts for mongoc_apm_topology_changed_t, implement at the end of _mongoc_topology_scanner_cb?
      • Enable test asserts for mongoc_apm_topology_opening_t, implement in mongoc_topology_description_init.
      • Enable test asserts for mongoc_apm_topology_closed_t, implement in mongoc_topology_description_destroy.
      • Enable test asserts for mongoc_apm_server_heartbeat_started_t, implement in new function mongoc_server_description_heartbeat_started, called from mongoc_topology_scanner_node_setup?
      • Enable test asserts for mongoc_apm_server_heartbeat_succeeded_t, implement in mongoc_server_description_handle_ismaster.
      • Enable test asserts for mongoc_apm_server_heartbeat_failed_t, implement in mongoc_server_description_handle_ismaster.

      Finally, update application-performance-monitoring.page with an SDAM Monitoring example.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            rathi.gnanasekaran Rathi Gnanasekaran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: