project-lux / lux-marklogic

Code, issues, and resources related to LUX MarkLogic
Other
3 stars 2 forks source link

#177 and #183: log additional details on failed searchEstimate and searchWillMatch requests #197

Closed brent-hartwig closed 3 days ago

brent-hartwig commented 3 days ago

New Trace/Log Messages

  1. Message when the searchEstimate request fails entirely.
if (xdmp.traceEnabled(traceName)) {
  xdmp.trace(
    traceName,
    // Monitoring test and log mining script checks for "Search Estimate errored out".
    `Search Estimate errored out: ${JSON.stringify({
      exception: utils.getExceptionObjectElseMessage(e),
      scope,
      searchCriteria,
    })}`
  );
}
  1. Message when a single named search fails within searchWillMatch.
if (xdmp.traceEnabled(traceName)) {
  xdmp.trace(
    traceName,
    // Monitoring test and log mining script checks for "Search Will Match errored out".
    `A search named '${name}' given to Search Will Match errored out: ${JSON.stringify(
      { exception: utils.getExceptionObjectElseMessage(e), criteria }
    )}`
  );
}
  1. Message when the entire searchWillMatch request fails.
if (xdmp.traceEnabled(traceName)) {
  xdmp.trace(
    traceName,
    // Monitoring test and log mining script checks for "Search Will Match errored out".
    `Search Will Match errored out: ${JSON.stringify({
      exception: utils.getExceptionObjectElseMessage(e),
      multipleSearchCriteria,
    })}`
  );
}

Notes

Primarily for consistency, the try/catch blocks were added within the library code. If these do not catch the ones we have seen in performance tests (including #181), we may need to move the exception handling within the data services.

The LuxSearch trace event was used.

Monitoring tests https://git.yale.edu/lux-its/ml-cluster-formation/issues/19 and https://git.yale.edu/lux-its/ml-cluster-formation/issues/24 are to pick up on all three. The two searchWillMatch trace statements share a phrase that the monitoring test is to check for.

Log mining scripts were updated to grep for the new phrases and write those log entries into failedSearchEstimateRequests.txt and failedSearchWillMatchRequests.txt.