[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/mm/NMS-20007-smoke/[email protected]>
  Branch: refs/heads/mm/NMS-20007-smoke
  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.



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.