[OpenNMS/opennms] dff6d6: NMS-20007: Make thresholding metadata scope creati...

Marshall Massengill via opennms-cvs <[email protected]>
Newsgroups gmane.network.opennms.cvs
Message-ID <OpenNMS/opennms/push/refs/heads/foundation-2024/[email protected]>
  Branch: refs/heads/foundation-2024
  Home:   https://github.com/OpenNMS/opennms
  Commit: dff6d640765adbaa6a14978bbaba7453795ae109
      https://github.com/OpenNMS/opennms/commit/dff6d640765adbaa6a14978bbaba7453795ae109
  Author: Marshall Massengill <[email protected]>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

  Changed paths:
    A core/mate/api/src/main/java/org/opennms/core/mate/api/LazyScope.java
    A core/mate/api/src/test/java/org/opennms/core/mate/api/LazyScopeTest.java
    M features/collection/thresholding/impl/src/main/java/org/opennms/netmgt/threshd/ThresholdEntity.java
    M features/collection/thresholding/impl/src/main/java/org/opennms/netmgt/threshd/ThresholdingSetImpl.java
    M features/collection/thresholding/impl/src/main/java/org/opennms/netmgt/threshd/ThresholdingVisitorImpl.java

  Log Message:
  -----------
  NMS-20007: Make thresholding metadata scope creation lazy and shared per collection set

Since NMS-16966, applyThresholds/passedThresholdFilters/evaluateAndCreateEvents
each eagerly built an entity scope (3 read-only DB transactions loading the
node, interface and service entity graphs) per collection resource and per
threshold entity, on every collection cycle - even when no threshold definition
contains a metadata expression. On interface-heavy systems this produces tens
of thousands of database transactions per second (SUPPORT-3261).

Two changes:

1. Introduce LazyScope, a memoizing Scope wrapper, and build thresholding
   scopes lazily. Interpolation only consults a scope when the input contains
   an actual ${} expression, so configurations without metadata expressions
   now perform zero database work in the thresholding path.

2. Share one scope across the whole collection set. The scope only depends on
   session-level state (node id, host address, service name), never on the
   individual resource, so ThresholdingVisitorImpl builds a single lazy scope
   per visit. Configurations that do use metadata expressions go from one
   scope build per resource per threshold entity to at most one per service
   per collection cycle.


  Commit: 0c8a83a6e4dd0dd9c4b33fcddba9185a3d68104c
      https://github.com/OpenNMS/opennms/commit/0c8a83a6e4dd0dd9c4b33fcddba9185a3d68104c
  Author: Marshall Massengill <[email protected]>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

  Changed paths:
    M core/mate/api/src/main/java/org/opennms/core/mate/api/LazyScope.java

  Log Message:
  -----------
  NMS-20007: Fail with a clear message if a lazy scope supplier returns null

Addresses Copilot review feedback: split the eager null check on the
supplier from the memoization, and name the failure when a supplier
produces a null scope at materialization time.


  Commit: c56be3d4e4910c3d90655a2bf44711b8203b4df9
      https://github.com/OpenNMS/opennms/commit/c56be3d4e4910c3d90655a2bf44711b8203b4df9
  Author: Marshall Massengill <[email protected]>
  Date:   2026-07-16 (Thu, 16 Jul 2026)

  Changed paths:
    A core/mate/api/src/main/java/org/opennms/core/mate/api/LazyScope.java
    A core/mate/api/src/test/java/org/opennms/core/mate/api/LazyScopeTest.java
    M features/collection/thresholding/impl/src/main/java/org/opennms/netmgt/threshd/ThresholdEntity.java
    M features/collection/thresholding/impl/src/main/java/org/opennms/netmgt/threshd/ThresholdingSetImpl.java
    M features/collection/thresholding/impl/src/main/java/org/opennms/netmgt/threshd/ThresholdingVisitorImpl.java

  Log Message:
  -----------
  Merge pull request #8631 from OpenNMS/mm/NMS-20007-smoke

NMS-20007: Thresholding builds metadata scopes per resource and per threshold


Compare: https://github.com/OpenNMS/opennms/compare/d7dd307d0cf8...c56be3d4e491

To unsubscribe from these emails, change your notification settings at https://github.com/OpenNMS/opennms/settings/notifications


_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/wiki/index.php?page=MailingListFaq
opennms-cvs mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.