Browse Source

Add QueryOptions to api package's monitor

pull/2538/head
Kyle Havlovitz 8 years ago
parent
commit
8079c49c0a
  1. 3
      api/agent.go
  2. 2
      api/agent_test.go

3
api/agent.go

@ -416,8 +416,9 @@ func (a *Agent) DisableNodeMaintenance() error {
// Monitor returns a channel which will receive streaming logs from the agent // Monitor returns a channel which will receive streaming logs from the agent
// Providing a non-nil stopCh can be used to close the connection and stop the // Providing a non-nil stopCh can be used to close the connection and stop the
// log stream // log stream
func (a *Agent) Monitor(loglevel string, stopCh chan struct{}) (chan string, error) { func (a *Agent) Monitor(loglevel string, stopCh chan struct{}, q *QueryOptions) (chan string, error) {
r := a.c.newRequest("GET", "/v1/agent/monitor") r := a.c.newRequest("GET", "/v1/agent/monitor")
r.setQueryOptions(q)
if loglevel != "" { if loglevel != "" {
r.params.Add("loglevel", loglevel) r.params.Add("loglevel", loglevel)
} }

2
api/agent_test.go

@ -566,7 +566,7 @@ func TestAgent_Monitor(t *testing.T) {
agent := c.Agent() agent := c.Agent()
logCh, err := agent.Monitor("info", nil) logCh, err := agent.Monitor("info", nil, nil)
if err != nil { if err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }

Loading…
Cancel
Save