File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -22,3 +22,13 @@ import "google.golang.org/protobuf/proto"
2222func (x * ConnectionEvent ) Clone () * ConnectionEvent {
2323 return proto .Clone (x ).(* ConnectionEvent )
2424}
25+
26+ // GetEventSenderName returns name of the segment from the path who send the event
27+ func (x * ConnectionEvent ) GetEventSenderName () string {
28+ for v , k := range x .GetConnections () {
29+ if segment := k .GetPathSegmentById (v ); segment != nil {
30+ return segment .GetName ()
31+ }
32+ }
33+ return "unknown"
34+ }
Original file line number Diff line number Diff line change @@ -160,6 +160,16 @@ func (x *Connection) MatchesMonitorScopeSelector(selector *MonitorScopeSelector)
160160 return false
161161}
162162
163+ // GetPathSegmentById gets the path segment by passed id
164+ func (x * Connection ) GetPathSegmentById (id string ) * PathSegment {
165+ for _ , segment := range x .GetPath ().GetPathSegments () {
166+ if segment .GetId () == id {
167+ return segment
168+ }
169+ }
170+ return nil
171+ }
172+
163173// GetCurrentPathSegment - Get the current path segment of the connection
164174func (x * Connection ) GetCurrentPathSegment () * PathSegment {
165175 if x == nil {
You can’t perform that action at this time.
0 commit comments