Skip to content

Commit

Permalink
Reviewed ability to parse metric vector
Browse files Browse the repository at this point in the history
Signed-off-by: Kedar Vijay Kulkarni <[email protected]>
  • Loading branch information
Kedar Vijay Kulkarni committed Oct 29, 2021
1 parent b591809 commit 291d0db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This tool allows OpenShift users to run a watcher for Prometheus queries and def

* [x] Create oc cli connection to OpenShift/Kubernetes using Kubeconfig
* [x] Determine Prometheus url, bearerToken for OpenShift
* [ ] If Prometheus url, bearerToken already included in the yaml, use that
* [x] If Prometheus url, bearerToken already included in the yaml, use that
* [ ] Create yaml format for queries, and expected outcomes (Use a struct to read that in)
* [ ] Spawn goroutines to keep running queries and evaluating results
* [ ] Notify/Do Something when results don't match conditions
6 changes: 5 additions & 1 deletion cmd/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ func RunQueries(promQueries map[string]bool, oc *exutil.CLI, baseURL, bearerToke
queryErrors[query] = fmt.Errorf(msg)
continue
}
log.Printf("Result is: %s", result.Data)
for _, r := range result.Data.Result {
log.Printf("Type is %[1]T \n Metric is: %[1]s\n\n", r.Metric)
log.Printf("Type is %[1]T \n Value is: %[1]s\n\n", r.Value)
}
log.Printf("Type is %[1]T \n Result is: %[1]s\n\n", result.Data.Result[0].Metric)
// query successful
passed[query] = struct{}{}
delete(queryErrors, query)
Expand Down

0 comments on commit 291d0db

Please sign in to comment.