From 536fa7de8f68704d4aa11c9a3ed72b534fa53004 Mon Sep 17 00:00:00 2001 From: Tim Raymond Date: Fri, 16 Sep 2016 12:11:28 -0400 Subject: [PATCH] Update influx package to support MonitoredServices The Timeseries interface was updated to include MonitoredServices as part of its spec. This adds a stub implementation of that. --- influx/influx.go | 10 +++++++++- mock/mock.go | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/influx/influx.go b/influx/influx.go index 9ed8c24b7..2bc49bb8e 100644 --- a/influx/influx.go +++ b/influx/influx.go @@ -12,7 +12,9 @@ type Client struct { ix ixClient.Client } -// NewClient initializes a Client +// NewClient initializes an HTTP Client for InfluxDB. UDP, although supported +// for querying InfluxDB, is not supported here to remove the need to +// explicitly Close the client. func NewClient(host string) (*Client, error) { cl, err := ixClient.NewHTTPClient(ixClient.HTTPConfig{ Addr: host, @@ -46,3 +48,9 @@ func (c *Client) Query(ctx context.Context, query mrfusion.Query) (mrfusion.Resp return nil, TimeoutError{} } } + +// MonitoredServices returns all services for which this instance of InfluxDB +// has time series information stored for. +func (c *Client) MonitoredServices(ctx context.Context) ([]mrfusion.MonitoredService, error) { + return []mrfusion.MonitoredService{}, nil +} diff --git a/mock/mock.go b/mock/mock.go index 9fa7bff03..0e1bec067 100644 --- a/mock/mock.go +++ b/mock/mock.go @@ -121,6 +121,10 @@ type Response struct { results []mrfusion.Result } +func (r *Response) MarshalJSON() ([]byte, error) { + return []byte(`{}`), nil +} + var SampleResponse mrfusion.Response = NewResponse(SampleResult) func NewResponse(result mrfusion.Result) mrfusion.Response {