We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3048e55 commit ea6d96cCopy full SHA for ea6d96c
pkg/commands/analyse.go
@@ -1,6 +1,10 @@
1
package commands
2
3
import (
4
+ "encoding/json"
5
+ "os"
6
+
7
+ log "github.com/sirupsen/logrus"
8
"gopkg.in/alecthomas/kingpin.v2"
9
)
10
@@ -91,4 +95,12 @@ func (cmd *AnalyseCommand) Register(app *kingpin.Application) {
91
95
ruleFileAnalyseCmd.Flag("output", "The path for the output file").
92
96
Default("metrics-in-ruler.json").
93
97
StringVar(&rfCmd.outputFile)
98
99
+ analyseCmd.Command("queries", "Extract the used metrics and labels from queries fed in on stdin.").Action(func(_ *kingpin.ParseContext) error {
100
+ metrics, err := processQueries(os.Stdin)
101
+ if err != nil {
102
+ log.Fatalf("failed to process queries: %v", err)
103
+ }
104
+ return json.NewEncoder(os.Stdout).Encode(metrics)
105
+ })
94
106
}
0 commit comments