Skip to content

Commit

Permalink
fix: fill metadata with typer version id if exist (rudderlabs#4897)
Browse files Browse the repository at this point in the history
* fix(tracking-plan): fill metadata with typer version id if exist

* fix(tracking-plan): take tp id from typer

* fix(tracking-plan): refactor code

* fix(tracking-plan): add non empty case
  • Loading branch information
akashrpo authored Jul 17, 2024
1 parent 8aa0e49 commit aab477b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1820,9 +1820,20 @@ func (proc *Handle) processJobsForDest(partition string, subJobs subJob) *transf
&backendconfig.DestinationT{},
)

// TODO: TP ID preference 1.event.context set by rudderTyper 2.From WorkSpaceConfig (currently being used)
shallowEventCopy.Metadata.TrackingPlanId = source.DgSourceTrackingPlanConfig.TrackingPlan.Id
shallowEventCopy.Metadata.TrackingPlanVersion = source.DgSourceTrackingPlanConfig.TrackingPlan.Version
trackingPlanID := source.DgSourceTrackingPlanConfig.TrackingPlan.Id
trackingPlanVersion := source.DgSourceTrackingPlanConfig.TrackingPlan.Version
rudderTyperTPID := misc.MapLookup(singularEvent, "context", "ruddertyper", "trackingPlanId")
rudderTyperTPVersion := misc.MapLookup(singularEvent, "context", "ruddertyper", "trackingPlanVersion")
if rudderTyperTPID != nil && rudderTyperTPVersion != nil {
if id, ok := rudderTyperTPID.(string); ok && id != "" {
trackingPlanID = id
}
if version, ok := rudderTyperTPVersion.(int); ok && version > 0 {
trackingPlanVersion = version
}
}
shallowEventCopy.Metadata.TrackingPlanId = trackingPlanID
shallowEventCopy.Metadata.TrackingPlanVersion = trackingPlanVersion
shallowEventCopy.Metadata.SourceTpConfig = source.DgSourceTrackingPlanConfig.Config
shallowEventCopy.Metadata.MergedTpConfig = source.DgSourceTrackingPlanConfig.GetMergedConfig(commonMetadataFromSingularEvent.EventType)

Expand Down

0 comments on commit aab477b

Please sign in to comment.