Skip to content

Commit

Permalink
Minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwoodward committed Apr 13, 2022
1 parent d61a933 commit 60ceaab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/prometheus/v1/api.go
Expand Up @@ -844,6 +844,7 @@ func (h *httpAPI) Query(ctx context.Context, query string, ts time.Time, opts ..
if t > 0 {
q.Set("timeout", fmt.Sprint(t))
}

q.Set("query", query)
if !ts.IsZero() {
q.Set("time", formatTime(ts))
Expand Down
2 changes: 1 addition & 1 deletion api/prometheus/v1/example_test.go
Expand Up @@ -39,7 +39,7 @@ func ExampleAPI_query() {
v1api := v1.NewAPI(client)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
result, warnings, err := v1api.Query(ctx, "up", time.Now(), v1.WithTimeout(time.Second*5))
result, warnings, err := v1api.Query(ctx, "up", time.Now(), v1.WithTimeout(5*time.Second))
if err != nil {
fmt.Printf("Error querying Prometheus: %v\n", err)
os.Exit(1)
Expand Down

0 comments on commit 60ceaab

Please sign in to comment.