Skip to content
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

Autocomplete regex several issues #3635

Closed
mdisibio opened this issue May 1, 2024 · 0 comments · Fixed by #3641
Closed

Autocomplete regex several issues #3635

mdisibio opened this issue May 1, 2024 · 0 comments · Fixed by #3641
Assignees
Labels
good first issue Good for newcomers

Comments

@mdisibio
Copy link
Contributor

mdisibio commented May 1, 2024

Describe the bug
(1) If we try to autocomplete a query like { .foo=~"(a|b)"} it seems like it should work but it doesn't (any tag name, doesn't matter). From debugging it is failing the check for single spanset operation, so probably the pipe | is incorrectly caught as a OR operation. Likely just need a tweak to the singleFilterRegexp regex: https://github.com/grafana/tempo/blob/main/pkg/traceql/extractmatcher.go#L36

(2) Simplifying the condition to =~"a" it still doesn't work. Here it is failing the matchersRegexp. I believe it's this section: [=|<=|>=|=~|!=|>|<|!~] which needs to be wrapped in parens instead of brackets to catch the multi-char operators: (=|<=|>=|=~|!=|>|<|!~)

Here's are some test cases for TextExtractMatchers:

{
    name:     "test",
    query:    `{.foo=~"(a|b)"}`,
    expected: `{.foo=~"(a|b)"}`,
},
{
    name:     "test",
    query:    `{.foo=~"a"}`,
    expected: `{.foo=~"a"}`,
},
expected: "{.foo=~\"(a|b)\"}"
actual  : "{}"

expected: "{.foo=~\"a\"}"
actual  : "{}"

To Reproduce
Steps to reproduce the behavior:

  1. Start Tempo (SHA or version)
  2. Perform Operations (Read/Write/Others)

Expected behavior

Environment:

  • Infrastructure: [e.g., Kubernetes, bare-metal, laptop]
  • Deployment tool: [e.g., helm, jsonnet]

Additional Context

@mdisibio mdisibio added the good first issue Good for newcomers label May 1, 2024
@sd2k sd2k self-assigned this May 1, 2024
sd2k added a commit that referenced this issue May 1, 2024
…tchers

Partially fixes #3635.

I'm going to add a further test case which this doesn't fix.
sd2k added a commit that referenced this issue May 2, 2024
…tchers

Partially fixes #3635.

I'm going to add a further test case which this doesn't fix.
sd2k added a commit that referenced this issue May 7, 2024
…tchers

Partially fixes #3635.

I'm going to add a further test case which this doesn't fix.
mdisibio pushed a commit that referenced this issue May 8, 2024
…tchers (#3641)

* fix(traceql): fix extract matcher regexes to work with regexp-type matchers

Partially fixes #3635.

I'm going to add a further test case which this doesn't fix.

* Add more test cases for extract matcher

* Add CHANGELOG entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants