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

Add Backlog Functionality #314

Merged
merged 1 commit into from
Sep 20, 2022
Merged

Add Backlog Functionality #314

merged 1 commit into from
Sep 20, 2022

Conversation

chimanjain
Copy link
Contributor

The Backlog class accepts notices and APM events and synchronously sends them in
the background at regular intervals (1 minute).

The notices that it accepts are those that have failed to be sent due to network
issues or Airbrake servers struggling. If the second attempt fails, then such
data is discarded forever.

The maximum backlog size is 100.

@chimanjain
Copy link
Contributor Author

PTAL

req.Header.Set("User-Agent", userAgent)
resp, err := qb.opt.HTTPClient.Do(req)
if err != nil {
logger.Printf("Backlog queue failed = %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.Printf("Backlog queue failed = %s", err)
logger.Errorf("Backlog queue failed = %s", err)

}
defer resp.Body.Close()
if resp.StatusCode > 400 {
logger.Printf("Backlog queue failed = %q", resp.Status)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.Printf("Backlog queue failed = %q", resp.Status)
logger.Errorf("Backlog queue failed = %q", resp.Status)

buf,
)
if err != nil {
logger.Printf("Backlog queue failed = %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.Printf("Backlog queue failed = %s", err)
logger.Errorf("Backlog queue failed = %s", err)

}
defer resp.Body.Close()
if resp.StatusCode > 400 {
logger.Printf("Backlog notice failed = %q", resp.Status)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.Printf("Backlog notice failed = %q", resp.Status)
logger.Errorf("Backlog notice failed = %q", resp.Status)

req.Header.Set("User-Agent", userAgent)
resp, err := nb.opt.HTTPClient.Do(req)
if err != nil {
logger.Printf("Backlog notice failed = %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.Printf("Backlog notice failed = %s", err)
logger.Errorf("Backlog notice failed = %s", err)

}
defer resp.Body.Close()
if resp.StatusCode > 400 {
logger.Printf("Backlog route stat failed = %q", resp.Status)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.Printf("Backlog route stat failed = %q", resp.Status)
logger.Errorf("Backlog route stat failed = %q", resp.Status)

backlog.go Outdated

// NewNoticeBacklog creates a new backlog for notices.
func NewNoticeBacklog(opt *NotifierOptions) *noticeBacklog {
if nb == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use once, do we really need to wrap this in if nb == nil?

backlog.go Outdated Show resolved Hide resolved
backlog.go Outdated Show resolved Hide resolved
backlog.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kyrylo kyrylo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@chimanjain
Copy link
Contributor Author

PTAL

@chimanjain chimanjain self-assigned this Sep 20, 2022
@chimanjain chimanjain merged commit 1fc65e5 into master Sep 20, 2022
@chimanjain chimanjain deleted the backlog-functionality branch September 20, 2022 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants