Skip to content

Conversation

@benclive
Copy link
Contributor

What this PR does / why we need it:
Drain was producing patterns which did not match the original line in some cases. Example logline:

13:25:18.033470 ▶ INFO route ops sending to dest https://graphite-cortex-ops-blocks-us-east4.grafana.net/graphite/metrics: service_is_carbon-relay-ng.instance_is_carbon-relay-ng-c665b7b-j2trk.mtype_is_gauge.dest_is_https_graphite-cortex-ops-blocks-us-east4_grafana_netgraphitemetrics.unit_is_B.what_is_FlushSize.type_is_manual.stat_is_max_999 0.00 1717075518

The issue was in the LogQL pattern matching code: The pattern parser was identifying the single UTF8 character as 3 separate ASCII characters. This is actually a single 3-byte UTF encoded character.
I added support for UTF-8 bytes in the Lexer to correctly identify them as 1 character in order to resolve this.

The lexer code was generated by Copilot, although I found an alternative implementation to check it against.

@benclive benclive requested a review from a team as a code owner May 30, 2024 15:44
}%%

%%{
utf8 = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this bit was generated by copilot but I've manually checked it and I think its correct. As far as I understand, anyway.

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

Lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants