Skip to content

Commit

Permalink
Change GetMetricsFromTimeSeriesResponse to getMetricsFromTimeSeriesRe…
Browse files Browse the repository at this point in the history
…sponse
  • Loading branch information
lawwong committed Dec 16, 2024
1 parent 309dfd3 commit 68303d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/watcher/internal/metricsprovider/datadog.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ func (s datadogClient) getMetricsHelper(window *watcher.Window, host string) (ma
responseContent, _ := json.MarshalIndent(resp, "", " ")
log.Debugf("Response from MetricsApi.QueryTimeseriesData:\n%s\n", responseContent)

return GetMetricsFromTimeSeriesResponse(resp)
return getMetricsFromTimeSeriesResponse(resp)
}

// This method parses the datadogV2 time series response and return a map with key hostname, value an array of watcher.Metric
func GetMetricsFromTimeSeriesResponse(resp datadogV2.TimeseriesFormulaQueryResponse) (map[string][]watcher.Metric, error) {
func getMetricsFromTimeSeriesResponse(resp datadogV2.TimeseriesFormulaQueryResponse) (map[string][]watcher.Metric, error) {
metrics := make(map[string][]watcher.Metric)
timeSeriesData, ok := resp.GetDataOk()
if !ok {
Expand Down
4 changes: 2 additions & 2 deletions pkg/watcher/internal/metricsprovider/datadog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestDDFetchAllHostMetrics(t *testing.T) {
err := resp.UnmarshalJSON(bytes)
assert.Nil(t, err)

metrics, err1 := GetMetricsFromTimeSeriesResponse(*resp)
metrics, err1 := getMetricsFromTimeSeriesResponse(*resp)

assert.Nil(t, err1)
assert.NotNil(t, metrics)
Expand Down Expand Up @@ -260,7 +260,7 @@ func TestDDFetchHostMetrics(t *testing.T) {
err := resp.UnmarshalJSON(bytes)
assert.Nil(t, err)

metrics, err1 := GetMetricsFromTimeSeriesResponse(*resp)
metrics, err1 := getMetricsFromTimeSeriesResponse(*resp)

assert.Nil(t, err1)
assert.NotNil(t, metrics)
Expand Down

0 comments on commit 68303d4

Please sign in to comment.