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

fix(logql): Make LabelSampleExtractor work as expected when label doesn't exist in logline #6766

Merged
merged 10 commits into from
Aug 3, 2022

Commits on Jul 25, 2022

  1. fix(logql): Make StringLabelfilter work as expected

    Consider Log lines
    
    ```
    msg=hello subqueries=5
    msg=hello subqueries=0
    msg=hello
    ```
    
    If you run following logql
    ```
    {foo="bar"}|logfmt|subqueries!=0
    ```
    it returns
    ```
    msg=hello subqueries=5
    ```
    
    But if you run following logql
    ```
    {foo="bar"}|logfmt|subqueries!="0" # NOTE: "0" as string.
    ```
    it returns
    ```
    msg=hello subqueries=5
    msg=hello
    ```
    
    NOTE: it also returns log lines that doesn't contain `subqueries` label in the first
    place.
    
    This cause subtle error if used in metric queries using that `label` in unwrap.
    
    e.g: following logql on above log lines returns
    ```
    sum_over_time({foo="bar"}|logfmt|subqueries!="0"|unwrap subqueries[1m])
    ```
    
    Returns `pipeline error: 'SampleExtractionErr'`. Because, the lines without `subqueries`
    labels are not skipped during `ProcessLine` and during metric extraction, our extractor
    sets this `SampleExtractionerror`.
    
    Fixes: #6713
    kavirajk committed Jul 25, 2022
    Configuration menu
    Copy the full SHA
    d0fbf3c View commit details
    Browse the repository at this point in the history
  2. Add it on changelog

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Jul 25, 2022
    Configuration menu
    Copy the full SHA
    a83da68 View commit details
    Browse the repository at this point in the history
  3. Fix linter

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Jul 25, 2022
    Configuration menu
    Copy the full SHA
    8120941 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2022

  1. Add more tests and fix the edge case with equality to empty strings

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Jul 27, 2022
    Configuration menu
    Copy the full SHA
    bab6ca0 View commit details
    Browse the repository at this point in the history
  2. typo on the comment

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Jul 27, 2022
    Configuration menu
    Copy the full SHA
    a50c635 View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2022

  1. handle this edge case during metric extraction. Not in label filter

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Aug 1, 2022
    Configuration menu
    Copy the full SHA
    40c5953 View commit details
    Browse the repository at this point in the history
  2. Fix linter

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Aug 1, 2022
    Configuration menu
    Copy the full SHA
    b915271 View commit details
    Browse the repository at this point in the history
  3. Remove commented code

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Aug 1, 2022
    Configuration menu
    Copy the full SHA
    b24112a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6568360 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2022

  1. Update changelog

    Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
    kavirajk committed Aug 3, 2022
    Configuration menu
    Copy the full SHA
    2f9b01e View commit details
    Browse the repository at this point in the history