mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 05:04:05 -08:00
Fix build errors in rest of prometheus
Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
This commit is contained in:
parent
273ea9093a
commit
20b1f596f6
|
@ -24,7 +24,7 @@ import (
|
|||
yaml "gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/prometheus/prometheus/pkg/timestamp"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
"github.com/prometheus/prometheus/template"
|
||||
)
|
||||
|
||||
|
@ -156,7 +156,7 @@ func (r *RuleNode) Validate() (nodes []WrappedError) {
|
|||
err: errors.Errorf("field 'expr' must be set in rule"),
|
||||
node: &r.Expr,
|
||||
})
|
||||
} else if _, err := promql.ParseExpr(r.Expr.Value); err != nil {
|
||||
} else if _, err := parser.ParseExpr(r.Expr.Value); err != nil {
|
||||
nodes = append(nodes, WrappedError{
|
||||
err: errors.Wrapf(err, "could not parse expression"),
|
||||
node: &r.Expr,
|
||||
|
|
|
@ -34,6 +34,7 @@ import (
|
|||
"github.com/prometheus/prometheus/pkg/rulefmt"
|
||||
"github.com/prometheus/prometheus/pkg/timestamp"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
"github.com/prometheus/prometheus/template"
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
)
|
||||
|
@ -112,7 +113,7 @@ type AlertingRule struct {
|
|||
// The name of the alert.
|
||||
name string
|
||||
// The vector expression from which to generate alerts.
|
||||
vector promql.Expr
|
||||
vector parser.Expr
|
||||
// The duration for which a labelset needs to persist in the expression
|
||||
// output vector before an alert transitions from Pending to Firing state.
|
||||
holdDuration time.Duration
|
||||
|
@ -144,7 +145,7 @@ type AlertingRule struct {
|
|||
|
||||
// NewAlertingRule constructs a new AlertingRule.
|
||||
func NewAlertingRule(
|
||||
name string, vec promql.Expr, hold time.Duration,
|
||||
name string, vec parser.Expr, hold time.Duration,
|
||||
labels, annotations, externalLabels labels.Labels,
|
||||
restored bool, logger log.Logger,
|
||||
) *AlertingRule {
|
||||
|
@ -201,7 +202,7 @@ func (r *AlertingRule) Health() RuleHealth {
|
|||
}
|
||||
|
||||
// Query returns the query expression of the alerting rule.
|
||||
func (r *AlertingRule) Query() promql.Expr {
|
||||
func (r *AlertingRule) Query() parser.Expr {
|
||||
return r.vector
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import (
|
|||
"github.com/prometheus/prometheus/pkg/timestamp"
|
||||
"github.com/prometheus/prometheus/pkg/value"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
"github.com/prometheus/prometheus/storage"
|
||||
)
|
||||
|
||||
|
@ -993,7 +994,7 @@ func (m *Manager) LoadGroups(
|
|||
|
||||
rules := make([]Rule, 0, len(rg.Rules))
|
||||
for _, r := range rg.Rules {
|
||||
expr, err := promql.ParseExpr(r.Expr.Value)
|
||||
expr, err := parser.ParseExpr(r.Expr.Value)
|
||||
if err != nil {
|
||||
return nil, []error{errors.Wrap(err, fn)}
|
||||
}
|
||||
|
|
|
@ -26,13 +26,14 @@ import (
|
|||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/pkg/rulefmt"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
"github.com/prometheus/prometheus/util/strutil"
|
||||
)
|
||||
|
||||
// A RecordingRule records its vector expression into new timeseries.
|
||||
type RecordingRule struct {
|
||||
name string
|
||||
vector promql.Expr
|
||||
vector parser.Expr
|
||||
labels labels.Labels
|
||||
// Protects the below.
|
||||
mtx sync.Mutex
|
||||
|
@ -47,7 +48,7 @@ type RecordingRule struct {
|
|||
}
|
||||
|
||||
// NewRecordingRule returns a new recording rule.
|
||||
func NewRecordingRule(name string, vector promql.Expr, lset labels.Labels) *RecordingRule {
|
||||
func NewRecordingRule(name string, vector parser.Expr, lset labels.Labels) *RecordingRule {
|
||||
return &RecordingRule{
|
||||
name: name,
|
||||
vector: vector,
|
||||
|
@ -62,7 +63,7 @@ func (rule *RecordingRule) Name() string {
|
|||
}
|
||||
|
||||
// Query returns the rule query expression.
|
||||
func (rule *RecordingRule) Query() promql.Expr {
|
||||
func (rule *RecordingRule) Query() parser.Expr {
|
||||
return rule.vector
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ import (
|
|||
"github.com/prometheus/prometheus/pkg/timestamp"
|
||||
"github.com/prometheus/prometheus/prompb"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
"github.com/prometheus/prometheus/rules"
|
||||
"github.com/prometheus/prometheus/scrape"
|
||||
"github.com/prometheus/prometheus/storage"
|
||||
|
@ -300,8 +301,8 @@ func (api *API) Register(r *route.Router) {
|
|||
}
|
||||
|
||||
type queryData struct {
|
||||
ResultType promql.ValueType `json:"resultType"`
|
||||
Result promql.Value `json:"result"`
|
||||
ResultType parser.ValueType `json:"resultType"`
|
||||
Result parser.Value `json:"result"`
|
||||
Stats *stats.QueryStats `json:"stats,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -534,7 +535,7 @@ func (api *API) series(r *http.Request) apiFuncResult {
|
|||
|
||||
var matcherSets [][]*labels.Matcher
|
||||
for _, s := range r.Form["match[]"] {
|
||||
matchers, err := promql.ParseMetricSelector(s)
|
||||
matchers, err := parser.ParseMetricSelector(s)
|
||||
if err != nil {
|
||||
return apiFuncResult{nil, &apiError{errorBadData, err}, nil, nil}
|
||||
}
|
||||
|
@ -695,7 +696,7 @@ func (api *API) targetMetadata(r *http.Request) apiFuncResult {
|
|||
var err error
|
||||
|
||||
if matchTarget != "" {
|
||||
matchers, err = promql.ParseMetricSelector(matchTarget)
|
||||
matchers, err = parser.ParseMetricSelector(matchTarget)
|
||||
if err != nil {
|
||||
return apiFuncResult{nil, &apiError{errorBadData, err}, nil, nil}
|
||||
}
|
||||
|
@ -1282,7 +1283,7 @@ func (api *API) deleteSeries(r *http.Request) apiFuncResult {
|
|||
}
|
||||
|
||||
for _, s := range r.Form["match[]"] {
|
||||
matchers, err := promql.ParseMetricSelector(s)
|
||||
matchers, err := parser.ParseMetricSelector(s)
|
||||
if err != nil {
|
||||
return apiFuncResult{nil, &apiError{errorBadData, err}, nil, nil}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/prometheus/prometheus/pkg/timestamp"
|
||||
"github.com/prometheus/prometheus/pkg/value"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
"github.com/prometheus/prometheus/promql/parser"
|
||||
"github.com/prometheus/prometheus/storage"
|
||||
)
|
||||
|
||||
|
@ -54,7 +55,7 @@ func (h *Handler) federation(w http.ResponseWriter, req *http.Request) {
|
|||
|
||||
var matcherSets [][]*labels.Matcher
|
||||
for _, s := range req.Form["match[]"] {
|
||||
matchers, err := promql.ParseMetricSelector(s)
|
||||
matchers, err := parser.ParseMetricSelector(s)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue