-
Notifications
You must be signed in to change notification settings - Fork 280
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
Rollbar pid files #938
Rollbar pid files #938
Conversation
@Aristat Thank you for the PR. Just a few questions. |
do_write_item(item) | ||
end | ||
end | ||
|
||
def do_write_item(item) |
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.
Is there a reason other than style for the method rename write_item
-> do_write_item
?
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.
I misread that. I see it now.
def do_write_item(item) | ||
log_info '[Rollbar] Writing item to file' | ||
|
||
body = item.dump | ||
return unless body | ||
|
||
file_name = if configuration.files_with_pid_name_enabled | ||
configuration.filepath.gsub(EXTENSION_REGEXP, "_#{Process.pid}\\0") |
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.
I'm not familiar with using the backslash zero in the filename here. Is this a convention?
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.
yeah, https://apidock.com/ruby/v2_6_3/String/gsub (see examples Replacing with "\" and match
), it's just needed for replace file_name.rollbar
to file_name_12345.rollbar
since in filepath
includes extension and I have to do the replacement in this way(I specified that new flags only work if .rollbar
is at the end, because it is hardcoded in a gem)
config.filepath ||= begin |
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.
I see, it's a backreference for gsub. Thank you.
Hi! We want to save the logs to different files for each puma workers, is it possible to add such a PR to the gem?
in addition:
processed
files(for smooth file processing by our agent)thanks!