-
Notifications
You must be signed in to change notification settings - Fork 330
chore: upload embedded dt response difference samples to s3 #5792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5792 +/- ##
==========================================
- Coverage 76.90% 76.89% -0.01%
==========================================
Files 491 491
Lines 67183 67206 +23
==========================================
+ Hits 51667 51681 +14
- Misses 12692 12703 +11
+ Partials 2824 2822 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
embeddedResponse, legacyResponse types.Response, | ||
) { | ||
if c.samplingFileManager == nil { // Cannot upload, we should just report the issue with no diff | ||
c.log.Errorn("DestinationTransformer sanity check failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we decrease this into a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any specific reason for this? We are logging a similar entry as an error for UT mirroring here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion, I think in hindsight we might end up having a huge amount of these and since they are not critical we might want an easy way to differentiate from the critical ones. In fact even the one I did for UT mirroring can be demoted to a warning.
c.log.Errorn("DestinationTransformer sanity check failed") | ||
return | ||
} | ||
|
||
c.loggedEventsMu.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't hold a mutex for long operations. Uploads can take a while and in destination_transformer.go
you're just firing go routines like go CompareAndLog(...)
and then hold a mutex here. This is a bad practice in my opinion we can do better. Is this mutex just to protect c.loggedEvents
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's to make sure we don't exceed the maxLoggedEvents
limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove the mutex, are we okay with not considering maxLoggedEvents
as a hard limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering the use case, we should be good if are close enough to maxLoggedEvents
, doesn't have to be precise at 100%, right? So an atomic
would do the job quite well: #5806
What do you think of that approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gist of it is to find a way to avoid this scenario:
- DT is somehow broken, we process a lot of messages and each one of them is different, ergo we end up with tons of diffs to upload
- uploads take a very long time
- we fire a lot of go routines continuously like
go c.CompareAndLog(...)
but none of them can take the lock (because of the slow upload) but we keep processing thus we keep firing go routines without control
I think the above might lead to memory issues and slow GC. At some point even in Golang there is a limit on how many go routines is too many go routines 😅
So we either use an atomic and end up logging a bit more or you come up with some other way to avoid the uncontrolled creation of go routines waiting on locks that might be locked for long periods. I'm sure there are different ways of doing this, just pointing out the potential problem but we don't have to use atomics, it was just an idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed to the mentioned problems. Why can't we just do a leaky logger approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we just do a leaky logger approach?
Are you referring to a leaky upload, or do we not even compare the payload in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ktgowtham I tried implementing a leaky logger, but using the main context to start the leaky logger added complexity. Initially, I tried using the context passed to Transform(), but I realised that a new context is created each time.
To fix this properly, we’d need to pass the main context down to transformer.NewClients
, which would require significant changes. I’m not sure if that effort is justified at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with minor suggestion around the atomic
approach. Personally I think that would be enough, without needing the leaky logger.
logger.NewStringField("location", file.Location), | ||
logger.NewStringField("objectName", file.ObjectName), | ||
) | ||
c.loggedEvents.Add(int64(len(differingResponse))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably coming from my own branch but on a second look I think this should be updated so that we bump loggedEvents
as soon as we know how many events we got. Basically something like this:
differingResponse, sampleDiff := c.differingEvents(embeddedResponse, legacyResponse)
if len(differingResponse) == 0 && sampleDiff == "" {
return
}
c.loggedEvents.Add(int64(len(differingResponse)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most precise I can think of is this: https://github.com/rudderlabs/rudder-server/pull/5816/files
Not overly complicated, also I don't think at this point we need a leaky logger either. The atomic approach seems safe and precise enough.
…b.com/rudderlabs/rudder-server into chore.upload-embedded-dt-diff-to-s3
…into chore.upload-embedded-dt-diff-to-s3
Description
Upload the embedded DT and rudder-transformation DT response difference log files to S3 instead of writing them to disk.
Linear Ticket
< PIPE-2047 >
Security