Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary metrics from _nodes ES API request #3860

Merged
merged 2 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/controller/elasticsearch/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func TestAPIError_Error(t *testing.T) {
}

func TestClientGetNodes(t *testing.T) {
expectedPath := "/_nodes/_all/jvm,settings"
expectedPath := "/_nodes/_all/no-metrics"
testClient := NewMockClient(version.MustParse("6.8.0"), func(req *http.Request) *http.Response {
require.Equal(t, expectedPath, req.URL.Path)
return &http.Response{
Expand All @@ -318,7 +318,6 @@ func TestClientGetNodes(t *testing.T) {
require.Equal(t, 3, len(resp.Nodes))
require.Contains(t, resp.Nodes, "iXqjbgPYThO-6S7reL5_HA")
require.ElementsMatch(t, []string{"master", "data", "ingest"}, resp.Nodes["iXqjbgPYThO-6S7reL5_HA"].Roles)
require.Equal(t, 2130051072, resp.Nodes["iXqjbgPYThO-6S7reL5_HA"].JVM.Mem.HeapMaxInBytes)
}

func TestClientGetNodesStats(t *testing.T) {
Expand Down
6 changes: 0 additions & 6 deletions pkg/controller/elasticsearch/client/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ type Node struct {
Name string `json:"name"`
Version string `json:"version"`
Roles []string `json:"roles"`
JVM struct {
StartTimeInMillis int64 `json:"start_time_in_millis"`
Mem struct {
HeapMaxInBytes int `json:"heap_max_in_bytes"`
} `json:"mem"`
} `json:"jvm"`
}

func (n Node) isV7OrAbove() (bool, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/elasticsearch/client/v6.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func (c *clientV6) ReloadSecureSettings(ctx context.Context) error {

func (c *clientV6) GetNodes(ctx context.Context) (Nodes, error) {
var nodes Nodes
// restrict call to basic node info only
err := c.get(ctx, "/_nodes/_all/jvm,settings", &nodes)
// restrict call to minimal node information with a non-existent metric filter
err := c.get(ctx, "/_nodes/_all/no-metrics", &nodes)
return nodes, err
}

Expand Down