mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 13:14:05 -08:00
Remove DotGraph method from Rule interface
This commit is contained in:
parent
83d07516e8
commit
75c920c95e
|
@ -16,7 +16,7 @@ package rules
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"reflect"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -188,21 +188,6 @@ func (rule *AlertingRule) Eval(timestamp clientmodel.Timestamp, engine *promql.E
|
||||||
return vector, nil
|
return vector, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DotGraph returns the text representation of a dot graph.
|
|
||||||
func (rule *AlertingRule) DotGraph() string {
|
|
||||||
graph := fmt.Sprintf(
|
|
||||||
`digraph "Rules" {
|
|
||||||
%#p[shape="box",label="ALERT %s IF FOR %s"];
|
|
||||||
%#p -> %x;
|
|
||||||
%s
|
|
||||||
}`,
|
|
||||||
&rule, rule.name, strutil.DurationToString(rule.holdDuration),
|
|
||||||
&rule, reflect.ValueOf(rule.Vector).Pointer(),
|
|
||||||
rule.Vector.DotGraph(),
|
|
||||||
)
|
|
||||||
return graph
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rule *AlertingRule) String() string {
|
func (rule *AlertingRule) String() string {
|
||||||
return fmt.Sprintf("ALERT %s IF %s FOR %s WITH %s", rule.name, rule.Vector, strutil.DurationToString(rule.holdDuration), rule.Labels)
|
return fmt.Sprintf("ALERT %s IF %s FOR %s WITH %s", rule.name, rule.Vector, strutil.DurationToString(rule.holdDuration), rule.Labels)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ package rules
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"reflect"
|
"strings"
|
||||||
|
|
||||||
clientmodel "github.com/prometheus/client_golang/model"
|
clientmodel "github.com/prometheus/client_golang/model"
|
||||||
|
|
||||||
|
@ -60,21 +60,6 @@ func (rule RecordingRule) Eval(timestamp clientmodel.Timestamp, engine *promql.E
|
||||||
return vector, nil
|
return vector, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DotGraph returns the text representation of a dot graph.
|
|
||||||
func (rule RecordingRule) DotGraph() string {
|
|
||||||
graph := fmt.Sprintf(
|
|
||||||
`digraph "Rules" {
|
|
||||||
%#p[shape="box",label="%s = "];
|
|
||||||
%#p -> %x;
|
|
||||||
%s
|
|
||||||
}`,
|
|
||||||
&rule, rule.name,
|
|
||||||
&rule, reflect.ValueOf(rule.vector).Pointer(),
|
|
||||||
rule.vector.DotGraph(),
|
|
||||||
)
|
|
||||||
return graph
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rule RecordingRule) String() string {
|
func (rule RecordingRule) String() string {
|
||||||
return fmt.Sprintf("%s%s = %s\n", rule.name, rule.labels, rule.vector)
|
return fmt.Sprintf("%s%s = %s\n", rule.name, rule.labels, rule.vector)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ type Rule interface {
|
||||||
Name() string
|
Name() string
|
||||||
// Eval evaluates the rule, including any associated recording or alerting actions.
|
// Eval evaluates the rule, including any associated recording or alerting actions.
|
||||||
Eval(clientmodel.Timestamp, *promql.Engine) (promql.Vector, error)
|
Eval(clientmodel.Timestamp, *promql.Engine) (promql.Vector, error)
|
||||||
// DotGraph returns a Graphviz dot graph of the rule.
|
|
||||||
DotGraph() string
|
|
||||||
// String returns a human-readable string representation of the rule.
|
// String returns a human-readable string representation of the rule.
|
||||||
String() string
|
String() string
|
||||||
// HTMLSnippet returns a human-readable string representation of the rule,
|
// HTMLSnippet returns a human-readable string representation of the rule,
|
||||||
|
|
Loading…
Reference in a new issue