Skip to content

Commit

Permalink
cli: use prometheus compatible structure
Browse files Browse the repository at this point in the history
When invoked with `-s rules|alerts` we now include the `groups:` prefix
so that the output can directly be piped into Prometheus rule files
  • Loading branch information
sh0rez committed Aug 5, 2021
1 parent cf782e4 commit a53dfe6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/pop/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func mixCmd() *cli.Command {
var out interface{} = mix
switch *system {
case "alerts":
out = mix.PrometheusAlerts
out = map[string]interface{}{"groups": mix.PrometheusAlerts}
case "rules":
out = mix.PrometheusRules
out = map[string]interface{}{"groups": mix.PrometheusRules}
case "grafana":
out = mix.GrafanaDashboards
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/pop/pop.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func (p Pop) Mixin() (*Mixin, error) {
return nil, mixed.Err()
}

if err := mixed.Validate(cue.Concrete(true)); err != nil {
return nil, err
}

mixin := mixer.LookupPath(cue.ParsePath("mixin"))

m := Mixin{
Expand Down

0 comments on commit a53dfe6

Please sign in to comment.