Skip to content

feat: use new Influx Line Protocol Parser#9871

Closed
powersj wants to merge 1 commit intoinfluxdata:masterfrom
powersj:feat/influx-line-protocol
Closed

feat: use new Influx Line Protocol Parser#9871
powersj wants to merge 1 commit intoinfluxdata:masterfrom
powersj:feat/influx-line-protocol

Conversation

@powersj
Copy link
Copy Markdown
Contributor

@powersj powersj commented Oct 6, 2021

Replaces the Influx Line Protocol parser with the new, zero-allocation parser found here. The only downside to the new parser is that we cannot get the current buffer when using the stream parser variant, so the messages will be slightly less descriptive when an error is encountered.

Blocked by influxdata/line-protocol#50
Previous PR #9685
Resolves #9474
Authored-by: Alex Krantz alex@krantz.dev

Required for all PRs:

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug new plugin plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins labels Oct 6, 2021
@powersj powersj added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin and removed fix pr to fix corresponding bug new plugin labels Oct 6, 2021
@oplehto
Copy link
Copy Markdown
Contributor

oplehto commented Oct 8, 2021

I'm still getting these intermittently on the data stream I'm testing with. The issue is that the upper bound is actually a negative offset so this still panics.

I added some quick instrumentation to see what's going on.

Here is what the relevant values look like that are used to calculate the upper bound for the slice. It seems that the cursor for lineStart ends up way beyond the error column for some reason:

2021-10-08T21:36:38Z I! Column: 236 lineStart: 75774
panic: runtime error: slice bounds out of range [:-75539]

I unfortunately did not capture the buffer at the time. I've set things up so that I get the data once this happens again.

@powersj powersj force-pushed the feat/influx-line-protocol branch from 57e9489 to beeb9b8 Compare October 8, 2021 22:03
@oplehto
Copy link
Copy Markdown
Contributor

oplehto commented Oct 12, 2021

Here is a case we caught in the data firehose where the parser is parsing a tag value as an integer and for some reason the error message output offset gets incremented too far:

2021-10-12T09:29:48Z I! http: panic serving 7.150.32.18:21520: out of bounds error in Decoder.syntaxErrorf; d.r: [0, 215]; offset: 216; d.line: 153:217; buf: [0:215]="zzzz_zzzzzz,application=XxxxXxx,author=Xxxxxxxx,description=Xxx\\ 0\\ In\\ 20,device_type=X00,host=zzz-yyyy,interface=xxxx,model_name=xxx-xx,val=0,port=20,serial_number=xxxx-xx-xxxxx-x,source=xxxx max_queue_time=0i "; error: cannot parse value for field key "\\ 0\\ In\\ 4,dev": invalid integer value syntax

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

The code looks good so far, but we have to track-down that panic...

@srebhan srebhan self-assigned this Oct 12, 2021
@srebhan
Copy link
Copy Markdown
Member

srebhan commented Oct 20, 2021

@powersj any update on the problem of panicing?

@powersj
Copy link
Copy Markdown
Contributor Author

powersj commented Oct 20, 2021

No - you can check the status of that on influxdata/line-protocol#50

@oplehto
Copy link
Copy Markdown
Contributor

oplehto commented Dec 2, 2021

@powersj @srebhan
It looks like influxdata/line-protocol#51 has resolved the issue.

I built a version of Telegraf that incorporates that PR and have not been able to crash it.

@powersj
Copy link
Copy Markdown
Contributor Author

powersj commented Dec 2, 2021

@oplehto thanks for confirming! I will get this PR updated with the latest parser code and we can let it bake a bit more.

@powersj powersj force-pushed the feat/influx-line-protocol branch 2 times, most recently from 0ef2755 to 4093dc8 Compare December 2, 2021 15:29
Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Looks good to me. Excellent work @akrantz01 and @powersj! @oplehto can you please confirm that this PR does not panic anymore?

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Dec 8, 2021
@oplehto
Copy link
Copy Markdown
Contributor

oplehto commented Dec 13, 2021

Looks good to me. Excellent work @akrantz01 and @powersj! @oplehto can you please confirm that this PR does not panic anymore?

I've had this running for a while now ingesting a very large amount of various metrics data and can confirm that I have not seen any issues anymore.

@sjwang90
Copy link
Copy Markdown
Contributor

We're planning on this new parser ~a month to bake in cloud. We'll check in on merging this in to Telegraf mid January 2022.

@popey
Copy link
Copy Markdown
Contributor

popey commented Jan 19, 2022

Now we're into mid-Jan, we should re-visit this PR.
Are we confident this has been exercised enough elsewhere to land in Telegraf?

@sjwang90
Copy link
Copy Markdown
Contributor

There have not been any issues with this new parser in InfluxDB Cloud. This will get added on our list to get reviewed and merged soon. Since this is new parser is a major feature implementation it won't officially be included until our next minor release in a couple months. However, once merged, you can use it and test with our nightlies.

@powersj powersj force-pushed the feat/influx-line-protocol branch 2 times, most recently from 4093dc8 to 109c30d Compare January 21, 2022 22:28
@telegraf-tiger
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

LGTM.

@powersj powersj force-pushed the feat/influx-line-protocol branch from 109c30d to 870ab5f Compare February 9, 2022 15:29
This switches to using the Influx Line Protocol Parser from
https://github.com/influxdata/line-protocol/

Authored-by: Alex Krantz alex@krantz.dev

Resolves: influxdata#9474
@powersj powersj force-pushed the feat/influx-line-protocol branch from 870ab5f to 04bc805 Compare February 9, 2022 21:29
@telegraf-tiger
Copy link
Copy Markdown
Contributor

telegraf-tiger bot commented Feb 9, 2022

@powersj powersj removed the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Mar 1, 2022
@powersj
Copy link
Copy Markdown
Contributor Author

powersj commented Mar 10, 2022

Hi,

Thanks to everyone for providing feedback on this feature. After talking through this change as a team, we decided to merge the feature as a flag of the parser. This means users can enable the use of the new parser backend by adding a new parser config option, "influx_parser_type" as shown below:

    data_format = "influx"
    influx_parser_type = "upstream"

The "upstream" value will enable the use of the new faster more memory efficient parser, while "internal", which is the default setting, will remain with the existing parser. This allows users to opt-in to the new parser and allow us to collect more confidence in ensuring existing configurations will not suddenly break. Our plan is to switch the default parser type in a future release.

The change was merged in as a part of #10749 and is now in master. Tonight's nightlies should have the change included them, and next weeks v1.22.0 release will be the first release with the new features. As such I am closing this PR.

Thanks again!

@powersj powersj closed this Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support the new Influx Line Protocol Parser

6 participants