Skip to content
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

Give up on remaining analytics messages when we fail to push to the buffer #1351

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions handlers/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,20 @@ func (c *AnalyticsHandlersCollection) Log() httprouter.Handle {
cerrors.WriteHTTPBadRequest(w, "Invalid playback_id", nil)
}

for _, ad := range c.toAnalyticsData(log, geo, extData) {
data := c.toAnalyticsData(log, geo, extData)
for i, ad := range data {
select {
case dataCh <- ad:
// process data async
default:
glog.Warningf("error processing analytics log, too many requests")
// Do some counting up of the different message types to give us a better picture of what's going on here
msgTypes := map[string]int{}
for _, msg := range data {
msgTypes[msg.EventType] += 1
}
glog.Warningf("error processing analytics log, too many requests. Failed to write %d lines. Message types: %v", len(data)-i, msgTypes)
cerrors.WriteHTTPInternalServerError(w, "error processing analytics log, too many requests", nil)
return
}
}
}
Expand Down
Loading