-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Merge Release/24.02.0 to main (#2701)
* chore: update all dependencies (#2687) * style: remove potential nil dereference (#2675) * chore: update all dependencies --------- Co-authored-by: Chris Grindstaff <chris@gstaff.org> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: StorageGrid Rest collector doesn't remove deleted Objects (#2677) * fix: StorageGrid Rest collector doesn't remove deleted Objects * fix: StorageGrid Rest collector doesn't remove deleted Objects * fix: NABox doctor command errors for custom.yaml * fix: WaflSizer RestPerf template panics (#2695) * fix: WaflSizer RestPerf template panics * fix: WaflSizer RestPerf template panics * fix: purging unused metrics from shelf template for 7mode (#2696) * fix: handle inter-cluster snapmirrors when different datacenter (#2688) (#2697) * fix: handle inter-cluster snapmirrors when different datacenter * doc: release 24.02 metric docs (#2694) * doc: release 24.02 metric docs * doc: update release 24.02 metric docs * doc: update release 24.02 metric docs * doc: update release 24.02 metric docs * fix: multi poller in a container should route logs to console (#2698) * fix: multi poller in a container should route logs to console * fix: multi poller in a container should route logs to console * doc: changelog doc (#2680) * doc: changelog doc * doc: release changelog (#2682) * doc: update changelog * doc: updated change log with review comment * doc: changelog 24.02 * doc: changelog 24.02 * doc: update changelog 24.02 * doc: update changelog doc for release 24.02 * doc: update changelog doc for release 24.02 --------- Co-authored-by: Chris Grindstaff <chris@gstaff.org> * doc: debian upgrade documentation (#2699) * doc: debian upgrade documentation * doc: debian upgrade documentation --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Chris Grindstaff <chris@gstaff.org> Co-authored-by: Rahul <rahul.gupta@netapp.com>
- Loading branch information
1 parent
9bee350
commit a11ef68
Showing
42 changed files
with
2,264 additions
and
66 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package rest | ||
|
||
import ( | ||
"bytes" | ||
|
||
"github.com/netapp/harvest/v2/pkg/auth" | ||
"github.com/netapp/harvest/v2/pkg/logging" | ||
"net/http" | ||
"time" | ||
) | ||
|
||
// NewDummyClient creates a new dummy client | ||
func NewDummyClient() *Client { | ||
httpClient := &http.Client{ | ||
Timeout: time.Second * 10, | ||
} | ||
|
||
httpRequest, _ := http.NewRequest(http.MethodGet, "http://example.com", nil) | ||
|
||
buffer := new(bytes.Buffer) | ||
|
||
logger := logging.Get() | ||
|
||
cluster := Cluster{ | ||
Name: "TestCluster", | ||
Info: "TestInfo", | ||
UUID: "TestUUID", | ||
Version: [3]int{1, 2, 3}, | ||
} | ||
|
||
client := &Client{ | ||
client: httpClient, | ||
request: httpRequest, | ||
buffer: buffer, | ||
Logger: logger, | ||
baseURL: "http://example.com", | ||
Cluster: cluster, | ||
token: "TestToken", | ||
Timeout: time.Second * 10, | ||
logRest: true, | ||
APIPath: "/api/v1", | ||
auth: &auth.Credentials{}, | ||
} | ||
|
||
return client | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package storagegrid | ||
|
||
import ( | ||
"github.com/netapp/harvest/v2/cmd/collectors" | ||
"github.com/netapp/harvest/v2/cmd/collectors/storagegrid/rest" | ||
"github.com/netapp/harvest/v2/cmd/poller/collector" | ||
"github.com/netapp/harvest/v2/cmd/poller/options" | ||
"github.com/netapp/harvest/v2/pkg/auth" | ||
"github.com/netapp/harvest/v2/pkg/conf" | ||
"github.com/tidwall/gjson" | ||
"os" | ||
"testing" | ||
) | ||
|
||
const ( | ||
pollerName = "test" | ||
) | ||
|
||
// newStorageGrid initializes a new StorageGrid instance for testing | ||
func newStorageGrid(object string, path string) (*StorageGrid, error) { | ||
opts := options.New(options.WithConfPath("testdata/conf")) | ||
opts.Poller = pollerName | ||
opts.HomePath = "testdata" | ||
opts.IsTest = true | ||
r := StorageGrid{} | ||
rest.NewClientFunc = func(_ string, _ string, _ *auth.Credentials) (*rest.Client, error) { | ||
return rest.NewDummyClient(), nil | ||
} | ||
ac := collector.New("StorageGrid", object, opts, collectors.Params(object, path), nil) | ||
err := r.Init(ac) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &r, nil | ||
} | ||
|
||
func Test_SGAddRemoveRestInstances(t *testing.T) { | ||
conf.TestLoadHarvestConfig("testdata/config.yml") | ||
|
||
sg, err := newStorageGrid("Tenant", "tenant.yaml") | ||
if err != nil { | ||
t.Fatalf("failed to create new StorageGrid: %v", err) | ||
} | ||
|
||
testFile(t, sg, "testdata/tenant.json", 9) | ||
testFile(t, sg, "testdata/tenant_delete.json", 8) | ||
testFile(t, sg, "testdata/tenant_add.json", 10) | ||
} | ||
|
||
func testFile(t *testing.T, sg *StorageGrid, filename string, expectedLen int) { | ||
output, err := os.ReadFile(filename) | ||
if err != nil { | ||
t.Fatalf("failed to read file: %v", err) | ||
} | ||
|
||
data := gjson.Get(string(output), "data") | ||
_ = sg.handleResults(data.Array()) | ||
|
||
got := len(sg.Matrix[sg.Object].GetInstances()) | ||
if got != expectedLen { | ||
t.Errorf("length of matrix = %v, want %v", got, expectedLen) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
cmd/collectors/storagegrid/testdata/conf/storagegrid/11.6.0/tenant.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
name: Tenant | ||
query: grid/accounts-cache | ||
object: tenant | ||
api: v3 | ||
|
||
counters: | ||
- ^^id => id | ||
- ^name => tenant | ||
- dataBytes => logical_used | ||
- objectCount => objects | ||
- policy.quotaObjectBytes => logical_quota | ||
|
||
export_options: | ||
instance_keys: | ||
- id | ||
- tenant | ||
instance_labels: | ||
- tenant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Exporters: | ||
prometheus: | ||
exporter: Prometheus | ||
port: 12990 | ||
|
||
Defaults: | ||
collectors: | ||
- StorageGrid | ||
exporters: | ||
- prometheus | ||
|
||
Pollers: | ||
test: | ||
addr: localhost |
Oops, something went wrong.