@@ -84,6 +84,7 @@ type npCollectorImpl struct {
8484 networkDevicesNamespace string
8585 filterMutex sync.RWMutex
8686 filter * connfilter.ConnFilter
87+ localFilter * connfilter.ConnFilter
8788 localIPs * localIPCache
8889 remoteConfigState dynamicRemoteConfigState
8990}
@@ -133,7 +134,8 @@ func newNpCollectorImpl(epForwarder eventplatform.Forwarder, collectorConfigs *c
133134 flushLoopDone : make (chan struct {}),
134135 workersDone : make (chan struct {}),
135136
136- filter : filter ,
137+ filter : filter ,
138+ localFilter : filter ,
137139 }
138140}
139141
@@ -212,7 +214,7 @@ type pathEvaluation struct {
212214 tags []string
213215}
214216
215- func (s * npCollectorImpl ) evaluateNetworkPathForConn (conn npmodel.NetworkPathConnection , origin payload.PathOrigin , vpcSubnets []netip.Prefix ) pathEvaluation {
217+ func (s * npCollectorImpl ) evaluateNetworkPathForConn (conn npmodel.NetworkPathConnection , origin payload.PathOrigin , vpcSubnets []netip.Prefix , baselineMode bool ) pathEvaluation {
216218 if conn .IntraHost {
217219 _ = s .statsdClient .Incr (netpathConnsSkippedMetricName , []string {"reason:skip_intra_host" }, 1 )
218220 return pathEvaluation {}
@@ -241,9 +243,18 @@ func (s *npCollectorImpl) evaluateNetworkPathForConn(conn npmodel.NetworkPathCon
241243 return pathEvaluation {}
242244 }
243245
244- s .filterMutex .RLock ()
245- included , testConfigID , tags := s .filter .EvaluateWithTags (conn .Domain , conn .Dest .Addr ())
246- s .filterMutex .RUnlock ()
246+ var included bool
247+ var testConfigID string
248+ var tags []string
249+ if baselineMode {
250+ // Dynamic Remote Configuration admits standard tests only. Baseline
251+ // selection must remain governed by built-in and local filters.
252+ included , testConfigID , tags = s .localFilter .EvaluateWithTags (conn .Domain , conn .Dest .Addr ())
253+ } else {
254+ s .filterMutex .RLock ()
255+ included , testConfigID , tags = s .filter .EvaluateWithTags (conn .Domain , conn .Dest .Addr ())
256+ s .filterMutex .RUnlock ()
257+ }
247258 if ! included {
248259 _ = s .statsdClient .Incr (netpathConnsSkippedMetricName , []string {"reason:skip_not_matched_by_filters" }, 1 )
249260 return pathEvaluation {}
@@ -323,23 +334,18 @@ func (s *npCollectorImpl) scheduleNetworkPathTests(origin payload.PathOrigin, co
323334 }
324335 for conn := range conns {
325336 connCount ++
326- evaluation := s .evaluateNetworkPathForConn (conn , origin , vpcSubnets )
337+ evaluation := s .evaluateNetworkPathForConn (conn , origin , vpcSubnets , baselineMode )
327338 if ! evaluation .shouldSchedule {
328339 s .logger .Tracef ("Skipped connection: addr=%s, protocol=%s" , conn .Dest , conn .Type )
329340 continue
330341 }
331342 pathtest := s .makePathtest (conn , origin )
332- pathtest .TestConfigID = evaluation .testConfigID
333- pathtest .Tags = evaluation .tags
334- if evaluation .testConfigID != "" {
335- pathtest .TestConfigSource = payload .TestConfigSourceRemote
336- }
337343 if baselineMode {
338344 selectedBaselineCandidates = addBaselinePath (selectedBaselineCandidates , pathtest , conn .Signals )
339345 continue
340346 }
341347
342- if err := s .scheduleOne ( & pathtest ); err != nil {
348+ if err := s .scheduleStandardNetworkPathTest ( pathtest , evaluation ); err != nil {
343349 s .logger .Errorf ("Error scheduling pathtests: %s" , err )
344350 }
345351 }
@@ -349,6 +355,16 @@ func (s *npCollectorImpl) scheduleNetworkPathTests(origin payload.PathOrigin, co
349355 _ = s .statsdClient .Count (common .NetworkPathCollectorMetricPrefix + "schedule.conns_received" , int64 (connCount ), []string {}, 1 )
350356 _ = s .statsdClient .Gauge (common .NetworkPathCollectorMetricPrefix + "schedule.duration" , s .TimeNowFn ().Sub (startTime ).Seconds (), nil , 1 )
351357}
358+
359+ func (s * npCollectorImpl ) scheduleStandardNetworkPathTest (pathtest common.Pathtest , evaluation pathEvaluation ) error {
360+ pathtest .TestConfigID = evaluation .testConfigID
361+ pathtest .Tags = evaluation .tags
362+ if evaluation .testConfigID != "" {
363+ pathtest .TestConfigSource = payload .TestConfigSourceRemote
364+ }
365+ return s .scheduleOne (& pathtest )
366+ }
367+
352368func (s * npCollectorImpl ) scheduleBaselinePaths (selected []baselineCandidate ) {
353369 for i := range selected {
354370 if err := s .scheduleOne (& selected [i ].path ); err != nil {
0 commit comments