website icon indicating copy to clipboard operation
website copied to clipboard

Documentation states that serviceprofile regexes are in golang dialect, but this is not true

Open mdpye opened this issue 3 years ago • 3 comments

https://linkerd.io/2.10/tasks/getting-per-route-metrics/#troubleshooting

The regex matchers are evaluated by the rust regex engine, not the golang one, so this troubleshooting advice is incorrect.

As an example of the difference, [\w-,] is evaluated differently between the two.

  • In golang, this is a class containing all "word chars" (\w), the literal - and the literal ,. The hyphen is not considered a request for a range of chars, because it doesn't make sense to open a range with a character class.
  • In rust, this is an invalid regex, because it doesn't make sense to open a range with a character class.

mdpye avatar Jul 28 '22 15:07 mdpye

As soon as I saw this issue I immediately wondered what kind of terrible situation led you to discovering it. 😬

wmorgan avatar Jul 29 '22 14:07 wmorgan

Part of the issue was surely me, over fitting for the characters we expected in path parameters when [^/]+ would do the job in all cases and likely in all dialects. :man_facepalming:

But testing against the wrong engine surely didn't help :sweat_smile:

mdpye avatar Jul 29 '22 14:07 mdpye

We'll fix these docs. Sorry for the unintended consequences 😢

wmorgan avatar Jul 29 '22 16:07 wmorgan