@@ -39,18 +39,17 @@ type (
3939 }
4040
4141 InstanceWatcherService struct {
42- processOperator process.ProcessOperatorInterface
43- nginxConfigParser parser.ConfigParser
44- executer exec.ExecInterface
45- enabled * atomic.Bool
46- agentConfig * config.Config
47- instanceCache map [string ]* mpi.Instance
48- nginxConfigCache map [string ]* model.NginxConfigContext
49- instancesChannel chan <- InstanceUpdatesMessage
50- nginxConfigContextChannel chan <- NginxConfigContextMessage
51- nginxParser processParser
52- nginxAppProtectProcessParser processParser
53- cacheMutex sync.Mutex
42+ processOperator process.ProcessOperatorInterface
43+ nginxConfigParser parser.ConfigParser
44+ executer exec.ExecInterface
45+ enabled * atomic.Bool
46+ agentConfig * config.Config
47+ instanceCache map [string ]* mpi.Instance
48+ nginxConfigCache map [string ]* model.NginxConfigContext
49+ instancesChannel chan <- InstanceUpdatesMessage
50+ nginxConfigContextChannel chan <- NginxConfigContextMessage
51+ nginxParser processParser
52+ cacheMutex sync.Mutex
5453 }
5554
5655 InstanceUpdates struct {
@@ -75,16 +74,15 @@ func NewInstanceWatcherService(agentConfig *config.Config) *InstanceWatcherServi
7574 enabled .Store (true )
7675
7776 return & InstanceWatcherService {
78- agentConfig : agentConfig ,
79- processOperator : process .NewProcessOperator (),
80- nginxParser : NewNginxProcessParser (),
81- nginxAppProtectProcessParser : NewNginxAppProtectProcessParser (),
82- nginxConfigParser : parser .NewNginxConfigParser (agentConfig ),
83- instanceCache : make (map [string ]* mpi.Instance ),
84- cacheMutex : sync.Mutex {},
85- nginxConfigCache : make (map [string ]* model.NginxConfigContext ),
86- executer : & exec.Exec {},
87- enabled : enabled ,
77+ agentConfig : agentConfig ,
78+ processOperator : process .NewProcessOperator (),
79+ nginxParser : NewNginxProcessParser (),
80+ nginxConfigParser : parser .NewNginxConfigParser (agentConfig ),
81+ instanceCache : make (map [string ]* mpi.Instance ),
82+ cacheMutex : sync.Mutex {},
83+ nginxConfigCache : make (map [string ]* model.NginxConfigContext ),
84+ executer : & exec.Exec {},
85+ enabled : enabled ,
8886 }
8987}
9088
@@ -265,7 +263,7 @@ func (iw *InstanceWatcherService) instanceUpdates(ctx context.Context) (
265263) {
266264 iw .cacheMutex .Lock ()
267265 defer iw .cacheMutex .Unlock ()
268- nginxProcesses , nginxAppProtectProcesses , err := iw .processOperator .Processes (ctx )
266+ nginxProcesses , err := iw .processOperator .Processes (ctx )
269267 if err != nil {
270268 return instanceUpdates , err
271269 }
@@ -280,10 +278,6 @@ func (iw *InstanceWatcherService) instanceUpdates(ctx context.Context) (
280278 instancesFound [instance .GetInstanceMeta ().GetInstanceId ()] = instance
281279 }
282280
283- nginxAppProtectInstances := iw .nginxAppProtectProcessParser .Parse (ctx , nginxAppProtectProcesses )
284- for _ , instance := range nginxAppProtectInstances {
285- instancesFound [instance .GetInstanceMeta ().GetInstanceId ()] = instance
286- }
287281 newInstances , updatedInstances , deletedInstances := compareInstances (iw .instanceCache , instancesFound )
288282
289283 instanceUpdates .NewInstances = newInstances
0 commit comments