From e9f3447125c71a55eca29aa627cb24db8d0949c4 Mon Sep 17 00:00:00 2001 From: yuanbohan Date: Tue, 18 Jul 2023 19:15:06 +0800 Subject: [PATCH] feat: Labels to Vec instead of HashSet --- src/label/matcher.rs | 1 + src/label/mod.rs | 63 +++++- src/parser/ast.rs | 144 ++++++++------ src/parser/parse.rs | 462 +++++-------------------------------------- src/parser/promql.y | 11 +- 5 files changed, 196 insertions(+), 485 deletions(-) diff --git a/src/label/matcher.rs b/src/label/matcher.rs index 5ced7db..d5be943 100644 --- a/src/label/matcher.rs +++ b/src/label/matcher.rs @@ -16,6 +16,7 @@ use std::collections::HashSet; use std::fmt; use std::hash::{Hash, Hasher}; +use crate::label::METRIC_NAME; use crate::parser::token::{TokenId, T_EQL, T_EQL_REGEX, T_NEQ, T_NEQ_REGEX}; use regex::Regex; diff --git a/src/label/mod.rs b/src/label/mod.rs index 6a0af3a..2d2ca92 100644 --- a/src/label/mod.rs +++ b/src/label/mod.rs @@ -15,7 +15,6 @@ //! Label matchers and Well-known label names used by Prometheus components. mod matcher; - pub use matcher::{MatchOp, Matcher, Matchers}; use std::collections::HashSet; @@ -30,4 +29,64 @@ pub const INSTANCE_NAME: &str = "instance"; pub type Label = String; /// Unordered set for a group of labels. -pub type Labels = HashSet