-
Couldn't load subscription status.
- Fork 69
Automatically add missing new lines when combining exception stacks and make remove_tag_prefix mandatory #10
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
|
I'm getting a following exception when using this branch |
|
Judging from the line where this error is reported (exception_detector.rb:229), I'd guess that $RS is not defined in your environment. Could you try replacing it with "\n" and check whether the error disappears? |
|
Yeah I was not sure, not a Rubyist here ;-) You're right, that fixes it. |
| def combined_message | ||
| combined = '' | ||
| @messages.each do |m| | ||
| combined << $RS if !combined.empty? && !combined.end_with?("\n") |
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 program defensively and use "\n" if $RS is nil?
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.
Done. Used a member variable for that in order to ensure that this is looked up only once.
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 a static value that should never change. How about making it a class variable instead?
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.
Done.
README.rdoc
Outdated
| {output plugin for fluentd}[http://docs.fluentd.org/articles/output-plugin-overview] | ||
| which scans a log stream text messages or JSON records for multi-line exception | ||
| stack traces: If a consecutive sequence of log messages forms an exception stack | ||
| which scans a log stream text messages or JSON records containing single |
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.
a log stream of text messages?
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.
Done
README.rdoc
Outdated
| are so similar (e.g. because they contain the timestamp of the log entry) that | ||
| this loss of information is irrelevant. | ||
|
|
||
| When combining exception lines, it is ensured that they enter with a line |
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.
Sorry, can't parse this. Did you mean s/enter/end/?
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, thanks.
README.rdoc
Outdated
| this loss of information is irrelevant. | ||
|
|
||
| When combining exception lines, it is ensured that they enter with a line | ||
| separator. If they don't, a line separator is added to the original log message. |
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 second sentence is redundant (implied by "is ensured").
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.
OK
README.rdoc
Outdated
| Default: ''. | ||
|
|
||
| [remove_tag_prefix] The prefix to remove from the input tag when outputting | ||
| a record. A prefix has to be a complete tag part. |
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.
Let's change the heading to [remove_tag_prefix (required)] for consistency with other fluentd docs (e.g., in_tail) and make it the first parameter.
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.
Done
README.rdoc
Outdated
| tag foo.bar.baz is transformed to bar.baz and the input tag | ||
| 'foofoo.bar' is not modified. Default: empty string. | ||
| 'foofoo.bar' is not modified. | ||
| Removing a tag prefix is needed to avoid infinite |
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.
How about we put it in terms of what the user can/has to do, e.g.:
This must be non-empty to avoid infinite recursion in fluentd.
Speaking of which, do you want to check that this is non-empty and reject the config if it is? Removing the default simply ensures that this is specified by the user, not that it has a non-empty value.
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.
Done.
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.
What about the second part of the suggestion (writing code to check that this is non-empty)?
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.
Check and test added.
| gem.required_ruby_version = Gem::Requirement.new('>= 2.0') | ||
|
|
||
| gem.files = Dir['**/*'].keep_if { |file| File.file?(file) } | ||
| gem.files = Dir['**/*'].keep_if{ |file| File.file?(file) && |
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 curious: why did you have to remove the space before the opening brace?
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 didn't. Fixed.
|
|
||
| gem.files = Dir['**/*'].keep_if { |file| File.file?(file) } | ||
| gem.files = Dir['**/*'].keep_if{ |file| File.file?(file) && | ||
| !file.end_with?('gem') } |
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.
Nit: should this be !file.end_with?('.gem')?
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.
Done
| force_flush if @max_lines > 0 && @messages.length == @max_lines | ||
| end | ||
|
|
||
| def combined_message |
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 happy with defining a method for this -- too much Ruby magic. You are essentially injecting newlines after trace lines that don't have them, right? Why not do it as a comprehension, e.g.:
combined_message = @messages.inject([]) {|r, e| r << e; r << $RS unless e.empty? || e.end_with?("\n"); r}.join
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.
Done
|
All comments addressed. PTAL. |
| def combined_message | ||
| combined = '' | ||
| @messages.each do |m| | ||
| combined << $RS if !combined.empty? && !combined.end_with?("\n") |
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 a static value that should never change. How about making it a class variable instead?
README.rdoc
Outdated
| tag foo.bar.baz is transformed to bar.baz and the input tag | ||
| 'foofoo.bar' is not modified. Default: empty string. | ||
| 'foofoo.bar' is not modified. | ||
| Removing a tag prefix is needed to avoid infinite |
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.
What about the second part of the suggestion (writing code to check that this is non-empty)?
|
Hi Igor, comments addressed. PTAL. |
|
we've been running into the same problem this PR fixes recently. @igorpeshansky is there still anything left blocking from moving forward with this PR? |
|
Hi |
|
is this ever going to release??? |
|
Got the same issue this PR fixes. @igorpeshansky any update? |
|
any updates? |
|
I'm having the same issues with Java exceptions not having and ending new line char. |
|
Same here @igorpeshansky would be great if that could be merged |
|
@igorpeshansky what does it take to resolve this PR? |
This PR solves the following issues:
remove_tag_prefixis optional is a pitfall for users because re-emitting a log entry with the same tag causes an infinite recursion in fluentd.first_recordfield was only populated for JSON logs.The version number is bumped to 0.0.6