mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Updating Errors, and adding license
This commit is contained in:
parent
8ef8c8a291
commit
980bc01d67
3 changed files with 27 additions and 15 deletions
|
|
@ -92,11 +92,11 @@ func (n *queryBuilder) processQueryParts(queryParts []queryPart) ([]string, map[
|
|||
// We obviously can't generate label filters for these cases.
|
||||
fmt.Println("This is queryPart", qPart.labelName, qPart.operator, qPart.values)
|
||||
if qPart.labelName == "" {
|
||||
return nil, nil, ErrNewLabelNotSpecified
|
||||
return nil, nil, ErrLabelNotSpecified
|
||||
}
|
||||
|
||||
if !n.operatorIsSupported(qPart.operator) {
|
||||
return nil, nil, ErrNewOperatorNotSupportedByPrometheus
|
||||
return nil, nil, ErrUnsupportedOperator
|
||||
}
|
||||
|
||||
matcher, err := n.selectMatcher(qPart.operator, qPart.values)
|
||||
|
|
@ -128,7 +128,7 @@ func (n *queryBuilder) selectMatcher(operator selection.Operator, values []strin
|
|||
case selection.DoesNotExist:
|
||||
return prom.LabelEq, nil
|
||||
case selection.Equals, selection.DoubleEquals, selection.NotEquals, selection.In, selection.NotIn:
|
||||
return nil, ErrNewOperatorRequiresValues
|
||||
return nil, ErrMalformedQuery
|
||||
}
|
||||
} else if numValues == 1 {
|
||||
switch operator {
|
||||
|
|
@ -168,7 +168,7 @@ func (n *queryBuilder) selectTargetValue(operator selection.Operator, values []s
|
|||
// whose value is NOT "".
|
||||
return "", nil
|
||||
case selection.Equals, selection.DoubleEquals, selection.NotEquals, selection.In, selection.NotIn:
|
||||
return "", ErrNewOperatorRequiresValues
|
||||
return "", ErrMalformedQuery
|
||||
}
|
||||
} else if numValues == 1 {
|
||||
switch operator {
|
||||
|
|
@ -194,7 +194,7 @@ func (n *queryBuilder) selectTargetValue(operator selection.Operator, values []s
|
|||
// for their label selector.
|
||||
return strings.Join(values, "|"), nil
|
||||
case selection.Exists, selection.DoesNotExist:
|
||||
return "", ErrNewOperatorDoesNotSupportValues
|
||||
return "", ErrQueryUnsupportedValues
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue