Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #36 from promlabs/alternative-top
Browse files Browse the repository at this point in the history
Provide alternative "MetricName" top-level entrypoint
  • Loading branch information
Nexucis authored May 19, 2021
2 parents 6f53dba + 266248f commit c3636ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/promql.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

@top PromQL { Expr }
@top MetricName { MetricIdentifier }

@precedence {
pow @right,
Expand Down
7 changes: 7 additions & 0 deletions test/expression.txt
Original file line number Diff line number Diff line change
Expand Up @@ -833,3 +833,10 @@ foo offset 5d

==>
PromQL(Expr(OffsetExpr(Expr(VectorSelector(MetricIdentifier(Identifier))), Offset, Duration)))

# Parsing only metric names with alternative @top { "top": "MetricName" }

sum:my_metric_name:rate5m

==>
MetricName(MetricIdentifier(Identifier))

0 comments on commit c3636ff

Please sign in to comment.