Remove DotGraph method from Rule interface

pull/779/head
Fabian Reinartz 10 years ago
parent 83d07516e8
commit 75c920c95e

@ -16,7 +16,7 @@ package rules
import (
"fmt"
"html/template"
"reflect"
"strings"
"sync"
"time"
@ -188,21 +188,6 @@ func (rule *AlertingRule) Eval(timestamp clientmodel.Timestamp, engine *promql.E
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 {
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 (
"fmt"
"html/template"
"reflect"
"strings"
clientmodel "github.com/prometheus/client_golang/model"
@ -60,21 +60,6 @@ func (rule RecordingRule) Eval(timestamp clientmodel.Timestamp, engine *promql.E
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 {
return fmt.Sprintf("%s%s = %s\n", rule.name, rule.labels, rule.vector)
}

@ -28,8 +28,6 @@ type Rule interface {
Name() string
// Eval evaluates the rule, including any associated recording or alerting actions.
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() string
// HTMLSnippet returns a human-readable string representation of the rule,

Loading…
Cancel
Save