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

[Prometheus]Bug fix for less than and greater than operators on @time… #1267

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

vmmusings
Copy link
Member

@vmmusings vmmusings commented Jan 10, 2023

[Prometheus Datasource]Bug fix for less than and greater than operators on @timestamp dimension.

Below command is not working with strict greater than command.

source = prometheus.process_resident_memory_bytes | where @timestamp > '2023-01-10 17:21:33.000000'  | sort + @timestamp | head 5

Without fix:

{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "Prometheus Catalog doesn't support > in where command.",
    "type": "RuntimeException"
  },
  "status": 503
}

With fix:

{
  "schema": [
    {
      "name": "instance",
      "type": "string"
    },
    {
      "name": "@timestamp",
      "type": "timestamp"
    },
    {
      "name": "@value",
      "type": "double"
    },
    {
      "name": "monitor",
      "type": "string"
    },
    {
      "name": "job",
      "type": "string"
    }
  ],
  "datarows": [
    [
      "localhost:8000",
      "2023-01-10 14:56:12",
      1.5208448E7,
      "prometheus",
      "prometheus"
    ],
    [
      "localhost:8000",
      "2023-01-10 14:56:26",
      1.5208448E7,
      "prometheus",
      "prometheus"
    ],
    [
      "localhost:8000",
      "2023-01-10 14:56:40",
      1.5208448E7,
      "prometheus",
      "prometheus"
    ],
    [
      "localhost:8000",
      "2023-01-10 14:56:54",
      1.5208448E7,
      "prometheus",
      "prometheus"
    ],
    [
      "localhost:8000",
      "2023-01-10 14:57:08",
      1.5208448E7,
      "prometheus",
      "prometheus"
    ]
  ],
  "total": 5,
  "size": 5
}

Signed-off-by: vamsi-amazon [email protected]

Description

Strict Greater than and Strict Less than are supposed to work on timerange. This PR fixes that issues.

Issues Resolved

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@vmmusings vmmusings marked this pull request as ready for review January 10, 2023 20:32
@vmmusings vmmusings requested a review from a team as a code owner January 10, 2023 20:32
@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2023

Codecov Report

Merging #1267 (cfc4080) into main (1108379) will decrease coverage by 2.43%.
The diff coverage is 100.00%.

❗ Current head cfc4080 differs from pull request most recent head aaf6057. Consider uploading reports for the commit aaf6057 to get more accurate results

@@             Coverage Diff              @@
##               main    #1267      +/-   ##
============================================
- Coverage     98.35%   95.91%   -2.44%     
- Complexity     3604     3609       +5     
============================================
  Files           344      354      +10     
  Lines          8933     9604     +671     
  Branches        562      688     +126     
============================================
+ Hits           8786     9212     +426     
- Misses          142      334     +192     
- Partials          5       58      +53     
Flag Coverage Δ
query-workbench 62.76% <ø> (?)
sql-engine 98.35% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rage/querybuilder/SeriesSelectionQueryBuilder.java 100.00% <100.00%> (ø)
...rage/querybuilder/TimeRangeParametersResolver.java 100.00% <100.00%> (ø)
...c/main/java/org/opensearch/sql/expression/DSL.java 100.00% <0.00%> (ø)
...arch/sql/expression/datetime/DateTimeFunction.java 100.00% <0.00%> (ø)
...h/sql/expression/function/BuiltinFunctionName.java 100.00% <0.00%> (ø)
workbench/public/components/Main/main.tsx 53.00% <0.00%> (ø)
...ch/public/components/QueryResults/QueryResults.tsx 61.60% <0.00%> (ø)
workbench/public/application.tsx 0.00% <0.00%> (ø)
workbench/public/components/Header/Header.tsx 100.00% <0.00%> (ø)
...h/public/components/QueryLanguageSwitch/Switch.tsx 85.71% <0.00%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@dai-chen dai-chen added the bug Something isn't working label Jan 10, 2023
joshuali925
joshuali925 previously approved these changes Jan 10, 2023
@joshuali925
Copy link
Member

bwc failed?

@vmmusings
Copy link
Member Author

bwc failed?

Known issue, infra is working on it

@dai-chen
Copy link
Collaborator

Could you add IT for better understanding the issue? Btw, I forgot that did we document this kind of limited support somewhere?

@vmmusings
Copy link
Member Author

Could you add IT for better understanding the issue? Btw, I forgot that did we document this kind of limited support somewhere?

The above case is not listed. will add here.
https://github.com/opensearch-project/sql/blob/2.x/docs/user/ppl/admin/prometheus_connector.rst#prometheus-connector-limitations

Adding timestamp queries with current integ infra is little difficult. Will come back if I couldn't.

@dai-chen
Copy link
Collaborator

Could you add IT for better understanding the issue? Btw, I forgot that did we document this kind of limited support somewhere?

The above case is not listed. will add here. https://github.com/opensearch-project/sql/blob/2.x/docs/user/ppl/admin/prometheus_connector.rst#prometheus-connector-limitations

Adding timestamp queries with current integ infra is little difficult. Will come back if I couldn't.

I see. If not possible, please add more details in PR description. Thanks!

@vmmusings vmmusings merged commit 7554fcc into opensearch-project:main Jan 11, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 11, 2023
…stamp (#1267)

Signed-off-by: vamsi-amazon <[email protected]>

Signed-off-by: vamsi-amazon <[email protected]>
(cherry picked from commit 7554fcc)
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.4 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.4 2.4
# Navigate to the new working tree
cd .worktrees/backport-2.4
# Create a new branch
git switch --create backport/backport-1267-to-2.4
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7554fcc56019c076b2d828dd68a360dc67628b5e
# Push it to GitHub
git push --set-upstream origin backport/backport-1267-to-2.4
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.4

Then, create a pull request where the base branch is 2.4 and the compare/head branch is backport/backport-1267-to-2.4.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 11, 2023
…stamp (#1267)

Signed-off-by: vamsi-amazon <[email protected]>

Signed-off-by: vamsi-amazon <[email protected]>
(cherry picked from commit 7554fcc)
vmmusings added a commit that referenced this pull request Jan 11, 2023
…stamp (#1267) (#1271)

Signed-off-by: vamsi-amazon <[email protected]>

Signed-off-by: vamsi-amazon <[email protected]>
(cherry picked from commit 7554fcc)

Co-authored-by: vamsi-amazon <[email protected]>
vmmusings added a commit that referenced this pull request Jan 11, 2023
…stamp (#1267) (#1272)

Signed-off-by: vamsi-amazon <[email protected]>

Signed-off-by: vamsi-amazon <[email protected]>
(cherry picked from commit 7554fcc)

Co-authored-by: vamsi-amazon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants