@@ -165,7 +165,11 @@ func (s *applicationEventReporter) StreamApplicationEvents(
165165 logCtx .WithError (err ).Warn ("failed to get parent application's revision metadata, resuming" )
166166 }
167167
168- err = s .processResource (ctx , * rs , parentApplicationEntity , logCtx , eventProcessingStartedAt , parentDesiredManifests , appTree , manifestGenErr , a , parentAppSyncRevisionsMetadata , applicationVersions , argoTrackingMetadata )
168+ err = s .processResource (ctx , * rs , logCtx , eventProcessingStartedAt , parentDesiredManifests , manifestGenErr , a , applicationVersions , & ReportedEntityParentApp {
169+ app : parentApplicationEntity ,
170+ appTree : appTree ,
171+ revisionsMetadata : parentAppSyncRevisionsMetadata ,
172+ }, argoTrackingMetadata )
169173 if err != nil {
170174 s .metricsServer .IncErroredEventsCounter (metrics .MetricChildAppEventType , metrics .MetricEventUnknownErrorType , a .Name )
171175 return err
@@ -205,7 +209,11 @@ func (s *applicationEventReporter) StreamApplicationEvents(
205209 s .metricsServer .IncCachedIgnoredEventsCounter (metrics .MetricResourceEventType , a .Name )
206210 continue
207211 }
208- err := s .processResource (ctx , rs , a , logCtx , eventProcessingStartedAt , desiredManifests , appTree , manifestGenErr , nil , revisionsMetadata , nil , argoTrackingMetadata )
212+ err := s .processResource (ctx , rs , logCtx , eventProcessingStartedAt , desiredManifests , manifestGenErr , nil , nil , & ReportedEntityParentApp {
213+ app : a ,
214+ appTree : appTree ,
215+ revisionsMetadata : revisionsMetadata ,
216+ }, argoTrackingMetadata )
209217 if err != nil {
210218 s .metricsServer .IncErroredEventsCounter (metrics .MetricResourceEventType , metrics .MetricEventUnknownErrorType , a .Name )
211219 return err
@@ -254,15 +262,13 @@ func (s *applicationEventReporter) getAppForResourceReporting(
254262func (s * applicationEventReporter ) processResource (
255263 ctx context.Context ,
256264 rs appv1.ResourceStatus ,
257- parentApplication * appv1.Application ,
258265 logCtx * log.Entry ,
259266 appEventProcessingStartedAt string ,
260267 desiredManifests * apiclient.ManifestResponse ,
261- appTree * appv1.ApplicationTree ,
262268 manifestGenErr bool ,
263269 originalApplication * appv1.Application ,
264- revisionsMetadata * utils.AppSyncRevisionsMetadata ,
265270 applicationVersions * apiclient.ApplicationVersions ,
271+ reportedEntityParentApp * ReportedEntityParentApp ,
266272 argoTrackingMetadata * ArgoTrackingMetadata ,
267273) error {
268274 metricsEventType := metrics .MetricResourceEventType
@@ -278,25 +284,29 @@ func (s *applicationEventReporter) processResource(
278284 // get resource desired state
279285 desiredState := getResourceDesiredState (& rs , desiredManifests , logCtx )
280286
281- actualState , err := s .getResourceActualState (ctx , logCtx , metricsEventType , rs , parentApplication , originalApplication )
287+ actualState , err := s .getResourceActualState (ctx , logCtx , metricsEventType , rs , reportedEntityParentApp . app , originalApplication )
282288 if err != nil {
283289 return err
284290 }
285291 if actualState == nil {
286292 return nil
287293 }
288294
289- parentApplicationToReport , revisionMetadataToReport := s .getAppForResourceReporting (rs , ctx , logCtx , parentApplication , revisionsMetadata )
295+ parentApplicationToReport , revisionMetadataToReport := s .getAppForResourceReporting (rs , ctx , logCtx , reportedEntityParentApp . app , reportedEntityParentApp . revisionsMetadata )
290296
291297 var originalAppRevisionMetadata * utils.AppSyncRevisionsMetadata = nil
292298
293299 if originalApplication != nil {
294300 originalAppRevisionMetadata , _ = s .getApplicationRevisionsMetadata (ctx , logCtx , originalApplication )
295301 }
296302
297- ev , err := getResourceEventPayload (parentApplicationToReport , & rs , actualState , desiredState , appTree , manifestGenErr , appEventProcessingStartedAt , originalApplication , revisionMetadataToReport , originalAppRevisionMetadata , applicationVersions , argoTrackingMetadata )
303+ ev , err := getResourceEventPayload (& rs , actualState , desiredState , manifestGenErr , appEventProcessingStartedAt , originalApplication , originalAppRevisionMetadata , applicationVersions , & ReportedEntityParentApp {
304+ app : parentApplicationToReport ,
305+ appTree : reportedEntityParentApp .appTree ,
306+ revisionsMetadata : revisionMetadataToReport ,
307+ }, argoTrackingMetadata )
298308 if err != nil {
299- s .metricsServer .IncErroredEventsCounter (metricsEventType , metrics .MetricEventGetPayloadErrorType , parentApplication .Name )
309+ s .metricsServer .IncErroredEventsCounter (metricsEventType , metrics .MetricEventGetPayloadErrorType , reportedEntityParentApp . app .Name )
300310 logCtx .WithError (err ).Warn ("failed to get event payload, resuming" )
301311 return nil
302312 }
@@ -308,7 +318,7 @@ func (s *applicationEventReporter) processResource(
308318 appName = appRes .Name
309319 } else {
310320 utils .LogWithResourceStatus (logCtx , rs ).Info ("streaming resource event" )
311- appName = parentApplication .Name
321+ appName = reportedEntityParentApp . app .Name
312322 }
313323
314324 if err := s .codefreshClient .SendEvent (ctx , appName , ev ); err != nil {
0 commit comments