diff --git a/rules/alerting.go b/rules/alerting.go index b3fe2ea2a..a86e7876c 100644 --- a/rules/alerting.go +++ b/rules/alerting.go @@ -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) } diff --git a/rules/recording.go b/rules/recording.go index 8a94048b6..00668d678 100644 --- a/rules/recording.go +++ b/rules/recording.go @@ -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) } diff --git a/rules/rules.go b/rules/rules.go index 88a89705f..68e5809a8 100644 --- a/rules/rules.go +++ b/rules/rules.go @@ -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,