Skip to content

Conversation

AndrewChubatiuk
Copy link

@AndrewChubatiuk AndrewChubatiuk commented Oct 2, 2025

  • support variables, that are passed instead of numbers
  • add ParseWithVars, that preserves variables in expressions
  • add label_values function support to parse grafana queries

using library to properly modify metricsql expressions imported rules and dashboards here. while parsing metricsql expression in grafana dashboards it fails when:

  • unquoted variable is used as a function argument: histogram_quantile($quantile, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))
  • parsing expression, which contains grafana specific label_values function

@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 94.28571% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.10%. Comparing base (6ea382c) to head (34e335c).

Files with missing lines Patch % Lines
parser.go 89.65% 2 Missing and 1 partial ⚠️
lexer.go 97.36% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #57      +/-   ##
==========================================
+ Coverage   89.05%   89.10%   +0.05%     
==========================================
  Files          11       11              
  Lines        3681     3727      +46     
==========================================
+ Hits         3278     3321      +43     
- Misses        306      308       +2     
- Partials       97       98       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AndrewChubatiuk AndrewChubatiuk force-pushed the parse-variables-in-expressions branch 3 times, most recently from 9c8a777 to 3f46c44 Compare October 2, 2025 19:38
…pressions

Add `PrettifyExpr` that allows to return prettified string generated from existing expression
@AndrewChubatiuk AndrewChubatiuk force-pushed the parse-variables-in-expressions branch from 3f46c44 to 34e335c Compare October 3, 2025 06:58
@makasim makasim requested review from f41gh7 and makasim October 13, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant