-
Notifications
You must be signed in to change notification settings - Fork 69
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
Traceback breaking Python rules #62
Comments
Hi, thanks for the report! That sounds reasonable; if you'd like to make a PR for it, I'd be happy to review it. |
It should be possible just to add a transition from |
@igorpeshansky, that would definitely work as well: PYTHON_RULES = [
rule(:start_state, /^Traceback \(most recent call last\):$/, :python), # Start: line is exactly `Traceback (most recent call last):`
rule([:python, python_code], /^[\t ]+File /, :python_code), # starts with one or more tabs, followed by `File`
rule(:python_code, /[^\t ]/, :python), # anything that's not a tab
rule(:python, /^(?:[^\s.():]+\.)*[^\s.():]+:/, :start_state) # End: matches output of the actual Error (unindented line)
].freeze But wouldn't the following be much simpler and still work fine? (We used this with gliderlabs/logspout before we moved to fluentd): PYTHON_RULES = [
rule(:start_state, /^Traceback \(most recent call last\):$/, :python), # Start: line is exactly `Traceback (most recent call last):`
rule(:python, /^[\t ]+[\S]+.*/, :python), # starts with one or more tabs, followed by at least one non-whitespace character, followed by whatever
rule(:python, /^(?:[^\s.():]+\.)*[^\s.():]+:/, :start_state) # End: matches output of the actual Error (unindented line)
].freeze This would reduce the rule to only 2 states and a single regex for matching anything between the WDYT? |
@iwilltry42 It would work fine for gathering tracebacks when they are present, but may perennially do more work in the common case where there is no traceback. Pulling out the |
Okay, I guess I just don't know enough about how the plugin works. |
@igorpeshansky assigning to you, since it looks you're on it. |
Any progress @igorpeshansky 🙏🏼? |
Hi there,
we're using the fluent-plugin-detect-exceptions to get multiline Python tracebacks in Elasticsearch and it works great so far (thanks for that!).
However, we just found an issue.
The following traceback breaks the python rule and makes it sending a traceback stack before it's finished:
The last four lines of this traceback are being sent separately (line by line):
We already figured out, that it's being caused by this line combination:
Python Rules are:
It seems like it's exiting at
rule(:python, /^[\t ]+File /, :python_code) # A
, because it's expecting the next line to start withFile
again, which is not the case in this traceback.Couldn't the rules marked with
A
andB
be merged into some rule like "starts with at least one\t
followed by some text instead of distinguishing between lines starting withFile
and lines that just contain some code?Thanks in advance for any help :)
The text was updated successfully, but these errors were encountered: