Skip to content

Commit

Permalink
chore: debug replay for ticketswap
Browse files Browse the repository at this point in the history
  • Loading branch information
BonapartePC committed Dec 18, 2024
1 parent 7425659 commit 6c76790
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions processor/transformer/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,16 @@ func (trans *handle) transform(
}
// flip sourceID and originalSourceID if it's a replay source for the purpose of any user transformation
// flip back afterwards
fmt.Println("before swapping in clientEvents")
for i := range clientEvents {
fmt.Println("Metadata for client events: ", clientEvents[i].Metadata)
if clientEvents[i].Metadata.OriginalSourceID != "" {
fmt.Println("Original Source ID: ", clientEvents[i].Metadata.OriginalSourceID)
fmt.Println("Source ID: ", clientEvents[i].Metadata.SourceID)

Check warning on line 265 in processor/transformer/transformer.go

View check run for this annotation

Codecov / codecov/patch

processor/transformer/transformer.go#L264-L265

Added lines #L264 - L265 were not covered by tests
clientEvents[i].Metadata.OriginalSourceID, clientEvents[i].Metadata.SourceID = clientEvents[i].Metadata.SourceID, clientEvents[i].Metadata.OriginalSourceID
}
}
fmt.Println("after swapping in clientEvents")
sTags := stats.Tags{
"dest_type": clientEvents[0].Destination.DestinationDefinition.Name,
"dest_id": clientEvents[0].Destination.ID,
Expand Down Expand Up @@ -316,11 +321,15 @@ func (trans *handle) transform(
var outClientEvents []TransformerResponse
var failedEvents []TransformerResponse

fmt.Println("before swapping in transformResponse")
for _, batch := range transformResponse {
// Transform is one to many mapping so returned
// response for each is an array. We flatten it out
for _, transformerResponse := range batch {
fmt.Println("Metadata for transformer response: ", transformerResponse.Metadata)
if transformerResponse.Metadata.OriginalSourceID != "" {
fmt.Println("Original Source ID: ", transformerResponse.Metadata.OriginalSourceID)
fmt.Println("Source ID: ", transformerResponse.Metadata.SourceID)

Check warning on line 332 in processor/transformer/transformer.go

View check run for this annotation

Codecov / codecov/patch

processor/transformer/transformer.go#L331-L332

Added lines #L331 - L332 were not covered by tests
transformerResponse.Metadata.SourceID, transformerResponse.Metadata.OriginalSourceID = transformerResponse.Metadata.OriginalSourceID, transformerResponse.Metadata.SourceID
}
switch transformerResponse.StatusCode {
Expand All @@ -331,6 +340,7 @@ func (trans *handle) transform(
}
}
}
fmt.Println("after swapping in transformResponse")

trans.sentStat.Count(len(clientEvents))
trans.receivedStat.Count(len(outClientEvents))
Expand Down

0 comments on commit 6c76790

Please sign in to comment.