[OpenNMS/opennms] e42c3d: NMS-20204: Reduce per-event overhead in the event ...
Marshall Massengill via opennms-cvs <[email protected]>
| Newsgroups | gmane.network.opennms.cvs |
|---|---|
| Message-ID | <OpenNMS/opennms/push/refs/heads/mm/NMS-20204-smoke/[email protected]> |
Branch: refs/heads/mm/NMS-20204-smoke
Home: https://github.com/OpenNMS/opennms
Commit: e42c3d88345e6079ac2bfdc657e156dbbf73d433
https://github.com/OpenNMS/opennms/commit/e42c3d88345e6079ac2bfdc657e156dbbf73d433
Author: Marshall Massengill <[email protected]>
Date: 2026-08-11 (Tue, 11 Aug 2026)
Changed paths:
M opennms-config/src/main/java/org/opennms/netmgt/config/EventTranslatorConfigFactory.java
A opennms-config/src/test/java/org/opennms/netmgt/config/EventTranslatorCloneEventTest.java
A opennms-config/src/test/java/org/opennms/netmgt/config/EventTranslatorSqlValueTest.java
Log Message:
-----------
NMS-20204: Reduce per-event overhead in the event translator
EventTranslatorConfigFactory repeated most of its work on every event.
Value specs exposed matches() and getResult() as separate calls, and
TranslationMapping.translate() invoked both, so each value was resolved
twice per event. For a sql value that meant two connection checkouts,
two prepared statements and two round trips, and nested values were
evaluated three times. ValueSpec now exposes a single evaluate() that
returns whether the value matched along with the value to assign.
EvaluationResult carries the two separately rather than collapsing into
an Optional, because a sql lookup that finds a row with a null column is
a match whose value is null, which must not fall through to the
assignment default.
The matches regex was recompiled on every evaluation, and a "~"-prefixed
parameter name was recompiled once per parm scanned via String.matches.
Both are now compiled once when the value spec is constructed.
translate() cloned the event before running any assignment, so a mapping
that rejected the event still paid for the clone. Assignments are now
resolved against the source event first, which is safe because value
specs only ever read the source event, and the clone happens only once
the mapping is known to match. The early exit on the first assignment
that neither matches nor has a default is preserved, so a rejecting
mapping does no more work than before.
cloneEvent() deep-copied through a Java serialization round trip, which
spent most of its time re-writing class descriptors: 52 us/op against
0.74 us/op for a field copy through the immutable event model. Event
does not implement IEvent, so the copy goes via ImmutableMapper. Both
mappers cover all 34 of Event's fields.
m_translationSpecs is now volatile, since update() clears it while
translateEvent() reads it without synchronization.
No configuration, schema or interface changes.
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