Add event to update session when diagnostic counters changes#3407
Add event to update session when diagnostic counters changes#3407mrsuciu merged 1 commit intoOPCFoundation:masterfrom
Conversation
|
@Lessi30 I am not to sure about the naming of this event. This will be invoked for every service call related to the Session, I would not consider that an update to the Session. Maybe you name it more like SessionActivity or SessionDiagnosticsChanged |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3407 +/- ##
==========================================
+ Coverage 51.86% 59.96% +8.09%
==========================================
Files 370 377 +7
Lines 78618 78749 +131
Branches 13650 13714 +64
==========================================
+ Hits 40779 47218 +6439
+ Misses 33705 27156 -6549
- Partials 4134 4375 +241 ☔ 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 adds a new SessionUpdated event to the OPC UA server's session management infrastructure to notify when diagnostic counters change. The feature allows server applications to react to session changes without polling, by subscribing to the event that fires whenever a session's diagnostic counters are updated.
Key changes:
- Added
SessionUpdatedevent toISessionManagerinterface andSessionManagerimplementation - Added
SessionEventReason.Updatedenum value for the new event type - Implemented
UpdateSession()method to trigger the event - Modified
UpdateDiagnosticCounters()to automatically raise the event on every request
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| Libraries/Opc.Ua.Server/Session/ISessionManager.cs | Adds SessionUpdated event declaration, Updated enum value, and UpdateSession method to interface |
| Libraries/Opc.Ua.Server/Session/SessionManager.cs | Implements SessionUpdated event with thread-safe handlers, UpdateSession method, and routing in RaiseSessionEvent |
| Libraries/Opc.Ua.Server/Session/Session.cs | Triggers UpdateSession call at the end of UpdateDiagnosticCounters method |
63e0fad to
9ff1979
Compare
|
@marcschier, @romanett What's missing here to get this PR on its way? |
|
@Lessi30 please add a Test that ensures the Event is triggered correctly then we can merge this imo |
Done |
|
Is there anything else I need to do to ensure that the final pending check is successful? Or is it beyond my control? |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Proposed changes
The problem is that as a server, you don't automatically notice when something changes in a session. To avoid having to poll regularly at intervals, I introduced this event. It is triggered when the diagnostic counters of the session are updated. It also makes it easy to get the affected session updated. With polling, I would have to do this for every active session.
Related Issues
Types of changes
What types of changes does your code introduce?
Checklist