[Server] Add Support for Sampling Groups to CustomNodeManager#3075
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3075 +/- ##
==========================================
+ Coverage 57.44% 57.95% +0.50%
==========================================
Files 357 358 +1
Lines 69245 69339 +94
Branches 14235 14266 +31
==========================================
+ Hits 39780 40186 +406
+ Misses 25194 24833 -361
- Partials 4271 4320 +49 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for sampling groups to the CustomNodeManager by abstracting monitored item management into an IMonitoredItemManager interface with two implementations: one for sampling groups and one for the traditional monitored node mechanism. Key changes include adding new methods (e.g., SetMonitoringMode) to both server and client test services, updating the CustomNodeManager to use the new abstraction, and enabling sampling groups via the ReferenceServer and related configuration.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Opc.Ua.Server.Tests/ServerTestServices.cs | Added SetMonitoringMode method to forward calls to the underlying server, aligning with the new sampling group support. |
| Tests/Opc.Ua.Server.Tests/ServerFixture.cs | Added a sampling groups flag and integrated a call to enable sampling groups in the ReferenceServer during startup. |
| Tests/Opc.Ua.Server.Tests/ReferenceServerTest.cs | Updated tests to set UseSamplingGroupsInReferenceNodeManager and added a delay when sampling groups are active. |
| Tests/Opc.Ua.Client.Tests/ClientTestServices.cs | Added a SetMonitoringMode method in the client test services to complement server changes. |
| Libraries/Opc.Ua.Server/NodeManager/MonitoredItem/SamplingGroupMonitoredItemManager.cs | New implementation for managing monitored items when using sampling groups, including adjustments for zero sampling intervals. |
| Libraries/Opc.Ua.Server/Diagnostics/CustomNodeManager.cs | Refactored to delegate monitored item management to the new IMonitoredItemManager and updated event subscription and restoration code. |
| Applications/Quickstarts.Servers/ReferenceServer/* | Updated the ReferenceServer and related utilities to respect the sampling groups flag and pass it to the CustomNodeManager. |
|
@marcschier The changes are nonbreaking |
…on and monitoreditemsession are null
|
Still some work to be done on the SamplingGroup since it might leak instances with the current logic. |
|
@mrsuciu I fixed the disposal of Sampling groups, as soon as a subscription times out it deletes all MIs and this triggers a disposal of the sampling group. |
…p to sample in time" This reverts commit e12aa34.
Proposed changes
This PR introduces a
MonitoredItemManagerthat manages MonitoredItems for theCustomNodeManagerthisIMonitoredItemManagerabstraction has two default implementations, theMonitoredNodeMonitoredItemManagerand theSamplingGroupMonitoredItemManager. These allow theCustomNodeMangerto manage DataChangeMonitoredItems using the Sampling Group mechanism instead of using the MonitoredNode functionality.This PR is a first step to allow to obsolete the
CoreNodeManagerhaving it´s own implementation of theINodeManagerInterface, but instead relying on the proven mechanims of theCustomNodeManager.This PR also allows to increase the test coverage of the SamplingGroup implementation, that is not covered by tests yet.
The
CustomNodeMangerhas a new constructor overload, that allows to specify if the sampling group mechanism shall be used.The Reference Server is extended with a new Property
UseSamplingGroupsInReferenceNodeManagerthat allows to enable the use of Sampling Groups in the Reference Node Manager so CTT tests can be carried out with the Sampling Groups.The Parameter is also enabled in the Reference Server Test to verify the implementation of the sampling group.
Types of changes
Checklist
Further comments