From a6dd3f82183b4e7b1e18c789dca804e422a5f688 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Fri, 27 Sep 2024 06:21:15 -0400 Subject: [PATCH 01/11] volume mirror trasfer rate --- client.go | 1 + metrics.go | 29 +++++++++++++++++++++++++++++ metrics_types.go | 18 ++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/client.go b/client.go index 30a8eff..f9a6416 100644 --- a/client.go +++ b/client.go @@ -142,6 +142,7 @@ type Client interface { PerformanceMetricsByAppliance(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByApplianceResponse, error) PerformanceMetricsByNode(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByNodeResponse, error) PerformanceMetricsByVolume(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByVolumeResponse, error) + VolumeMirrorTransferRate(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]VolumeMirrorTransferRateResponse, error) PerformanceMetricsByCluster(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByClusterResponse, error) PerformanceMetricsByVM(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByVMResponse, error) PerformanceMetricsByVg(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByVgResponse, error) diff --git a/metrics.go b/metrics.go index 1acd664..a342665 100644 --- a/metrics.go +++ b/metrics.go @@ -21,9 +21,11 @@ package gopowerstore import ( "context" "errors" + "fmt" ) const metricsURL = "metrics" +const mirrorURL = "volume_mirror_transfer_rate_cma_view" func (c *ClientIMPL) metricsRequest(ctx context.Context, response interface{}, entity string, entityID string, interval MetricsIntervalEnum) error { _, err := c.APIClient().Query( @@ -45,6 +47,26 @@ func (c *ClientIMPL) metricsRequest(ctx context.Context, response interface{}, e return err } +// mirrorTransferRate - Volume Mirror Transfer Rate +func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{}, entityID string, interval MetricsIntervalEnum) error { + qp := getFSDefaultQueryParams(c) + qp.RawArg("volume_id", fmt.Sprintf("eq.%s", entityID)) + qp.RawArg("interval", string(interval)) + + _, err := c.APIClient().Query( + ctx, + RequestConfig{ + Method: "GET", + Endpoint: mirrorURL, + QueryParams: qp, + }, + response) + if err != nil { + err = WrapErr(err) + } + return err +} + // PerformanceMetricsByAppliance - Appliance performance metrics func (c *ClientIMPL) PerformanceMetricsByAppliance(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByApplianceResponse, error) { var resp []PerformanceMetricsByApplianceResponse @@ -66,6 +88,13 @@ func (c *ClientIMPL) PerformanceMetricsByVolume(ctx context.Context, entityID st return resp, err } +// VolumeMirrorTransferRate - Volume Mirror Transfer Rate +func (c *ClientIMPL) VolumeMirrorTransferRate(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]VolumeMirrorTransferRateResponse, error) { + var resp []VolumeMirrorTransferRateResponse + err := c.mirrorTransferRate(ctx, &resp, entityID, interval) + return resp, err +} + // PerformanceMetricsByCluster - Cluster performance metrics func (c *ClientIMPL) PerformanceMetricsByCluster(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByClusterResponse, error) { var resp []PerformanceMetricsByClusterResponse diff --git a/metrics_types.go b/metrics_types.go index 5d3cb26..663dab6 100644 --- a/metrics_types.go +++ b/metrics_types.go @@ -1194,6 +1194,24 @@ type PerformanceMetricsByVolumeResponse struct { CommonMaxAvgIopsBandwidthFields } +// VolumeMirrorTransferRateResponse is returned by volume_mirror_transfer_rate +type VolumeMirrorTransferRateResponse struct { + // Unique identifier representing a specific volume. + ID string `json:"id,omitempty"` + + // The timestamp of the last read or write operation. + Timestamp int64 `json:"timestamp,omitempty"` + + // The read or write bandwidth in bytes per second. + SynchronizationBandwidth int64 `json:"synchronization_bandwidth,omitempty"` + + // The read or write bandwidth in bytes per second. + MirrorBandwidth int64 `json:"mirror_bandwidth,omitempty"` + + // The amount of data remaining in the bandwidth + DataRemaining int64 `json:"data_remaining,omitempty"` +} + type CommonAvgFields struct { // Average size of read and write operations in bytes. AvgIoSize float32 `json:"avg_io_size,omitempty"` From b5f983e9312a47b63a13bae9def27eb7d2ecc0b5 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Fri, 27 Sep 2024 08:24:03 -0400 Subject: [PATCH 02/11] set mirror limit --- metrics.go | 5 +++-- metrics_types.go | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/metrics.go b/metrics.go index a342665..b342bb8 100644 --- a/metrics.go +++ b/metrics.go @@ -48,9 +48,10 @@ func (c *ClientIMPL) metricsRequest(ctx context.Context, response interface{}, e } // mirrorTransferRate - Volume Mirror Transfer Rate -func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{}, entityID string, interval MetricsIntervalEnum) error { +func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{}, entityID string, limit int, interval MetricsIntervalEnum) error { qp := getFSDefaultQueryParams(c) qp.RawArg("volume_id", fmt.Sprintf("eq.%s", entityID)) + qp.RawArg("limit", fmt.Sprintf("%d", limit)) qp.RawArg("interval", string(interval)) _, err := c.APIClient().Query( @@ -91,7 +92,7 @@ func (c *ClientIMPL) PerformanceMetricsByVolume(ctx context.Context, entityID st // VolumeMirrorTransferRate - Volume Mirror Transfer Rate func (c *ClientIMPL) VolumeMirrorTransferRate(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]VolumeMirrorTransferRateResponse, error) { var resp []VolumeMirrorTransferRateResponse - err := c.mirrorTransferRate(ctx, &resp, entityID, interval) + err := c.mirrorTransferRate(ctx, &resp, entityID, 2000, interval) return resp, err } diff --git a/metrics_types.go b/metrics_types.go index 663dab6..9896fd6 100644 --- a/metrics_types.go +++ b/metrics_types.go @@ -1200,16 +1200,16 @@ type VolumeMirrorTransferRateResponse struct { ID string `json:"id,omitempty"` // The timestamp of the last read or write operation. - Timestamp int64 `json:"timestamp,omitempty"` + Timestamp strfmt.DateTime `json:"timestamp,omitempty"` // The read or write bandwidth in bytes per second. - SynchronizationBandwidth int64 `json:"synchronization_bandwidth,omitempty"` + SynchronizationBandwidth float32 `json:"synchronization_bandwidth,omitempty"` // The read or write bandwidth in bytes per second. - MirrorBandwidth int64 `json:"mirror_bandwidth,omitempty"` + MirrorBandwidth float32 `json:"mirror_bandwidth,omitempty"` // The amount of data remaining in the bandwidth - DataRemaining int64 `json:"data_remaining,omitempty"` + DataRemaining float32 `json:"data_remaining,omitempty"` } type CommonAvgFields struct { From 593836e9dc1e6d8b5d5dee47dcf5e13c94b3bd51 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Mon, 30 Sep 2024 12:10:25 -0400 Subject: [PATCH 03/11] visibility set to Internal --- metrics.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/metrics.go b/metrics.go index b342bb8..6c845a3 100644 --- a/metrics.go +++ b/metrics.go @@ -22,6 +22,7 @@ import ( "context" "errors" "fmt" + "net/http" ) const metricsURL = "metrics" @@ -50,9 +51,15 @@ func (c *ClientIMPL) metricsRequest(ctx context.Context, response interface{}, e // mirrorTransferRate - Volume Mirror Transfer Rate func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{}, entityID string, limit int, interval MetricsIntervalEnum) error { qp := getFSDefaultQueryParams(c) - qp.RawArg("volume_id", fmt.Sprintf("eq.%s", entityID)) - qp.RawArg("limit", fmt.Sprintf("%d", limit)) - qp.RawArg("interval", string(interval)) + qp.RawArg("id", fmt.Sprintf("eq.%s", entityID)) + qp.Limit(limit) + //qp.RawArg("interval", string(interval)) + qp.RawArg("select", "id,timestamp,synchronization_bandwidth,mirror_bandwidth,data_remaining") + + customHeader := http.Header{} + customHeader.Add("DELL-VISIBILITY", "Internal") + apiClient := c.APIClient() + apiClient.SetCustomHTTPHeaders(customHeader) _, err := c.APIClient().Query( ctx, @@ -62,9 +69,11 @@ func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{ QueryParams: qp, }, response) + if err != nil { err = WrapErr(err) } + return err } From 9ab1988ca9405240ab13b8fee27b0d51ea4c45e3 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 07:20:19 -0400 Subject: [PATCH 04/11] volume mirror UT's --- client.go | 2 +- go.mod | 2 +- inttests/metrics_test.go | 13 +++++++++++++ metrics.go | 7 +++---- metrics_test.go | 17 +++++++++++++++++ mocks/Client.go | 28 ++++++++++++++++++++++++++++ 6 files changed, 63 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index f9a6416..66253f4 100644 --- a/client.go +++ b/client.go @@ -142,7 +142,7 @@ type Client interface { PerformanceMetricsByAppliance(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByApplianceResponse, error) PerformanceMetricsByNode(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByNodeResponse, error) PerformanceMetricsByVolume(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByVolumeResponse, error) - VolumeMirrorTransferRate(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]VolumeMirrorTransferRateResponse, error) + VolumeMirrorTransferRate(ctx context.Context, entityID string) ([]VolumeMirrorTransferRateResponse, error) PerformanceMetricsByCluster(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByClusterResponse, error) PerformanceMetricsByVM(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByVMResponse, error) PerformanceMetricsByVg(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]PerformanceMetricsByVgResponse, error) diff --git a/go.mod b/go.mod index 39c5d56..f0a3f92 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/dell/gopowerstore go 1.23 - +toolchain go1.23.1 require ( github.com/go-openapi/strfmt v0.23.0 github.com/jarcoal/httpmock v1.2.0 diff --git a/inttests/metrics_test.go b/inttests/metrics_test.go index 437f6ce..dfb2d80 100644 --- a/inttests/metrics_test.go +++ b/inttests/metrics_test.go @@ -60,6 +60,19 @@ func Test_PerformanceMetricsByVolume(t *testing.T) { assert.Equal(t, "performance_metrics_by_volume", resp[0].Entity) } +func Test_VolumeMirrorTransferRate(t *testing.T) { + volumesResp, err := C.GetVolumes(context.Background()) + checkAPIErr(t, err) + if len(volumesResp) == 0 { + t.Skip("no volumes are available to check for metrics") + return + } + resp, err := C.VolumeMirrorTransferRate(context.Background(), volumesResp[0].ID) + checkAPIErr(t, err) + assert.NotEmpty(t, resp) + assert.Equal(t, "volume_mirror_transfer_rate", resp[0].ID) +} + func Test_PerformanceMetricsByCluster(t *testing.T) { resp, err := C.PerformanceMetricsByCluster(context.Background(), "0", gopowerstore.FiveMins) checkAPIErr(t, err) diff --git a/metrics.go b/metrics.go index 6c845a3..6d64616 100644 --- a/metrics.go +++ b/metrics.go @@ -49,11 +49,10 @@ func (c *ClientIMPL) metricsRequest(ctx context.Context, response interface{}, e } // mirrorTransferRate - Volume Mirror Transfer Rate -func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{}, entityID string, limit int, interval MetricsIntervalEnum) error { +func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{}, entityID string, limit int) error { qp := getFSDefaultQueryParams(c) qp.RawArg("id", fmt.Sprintf("eq.%s", entityID)) qp.Limit(limit) - //qp.RawArg("interval", string(interval)) qp.RawArg("select", "id,timestamp,synchronization_bandwidth,mirror_bandwidth,data_remaining") customHeader := http.Header{} @@ -99,9 +98,9 @@ func (c *ClientIMPL) PerformanceMetricsByVolume(ctx context.Context, entityID st } // VolumeMirrorTransferRate - Volume Mirror Transfer Rate -func (c *ClientIMPL) VolumeMirrorTransferRate(ctx context.Context, entityID string, interval MetricsIntervalEnum) ([]VolumeMirrorTransferRateResponse, error) { +func (c *ClientIMPL) VolumeMirrorTransferRate(ctx context.Context, entityID string) ([]VolumeMirrorTransferRateResponse, error) { var resp []VolumeMirrorTransferRateResponse - err := c.mirrorTransferRate(ctx, &resp, entityID, 2000, interval) + err := c.mirrorTransferRate(ctx, &resp, entityID, 2000) return resp, err } diff --git a/metrics_test.go b/metrics_test.go index 3b4a0f0..6e83ff7 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -30,6 +30,9 @@ import ( ) const metricsMockURL = APIMockURL + metricsURL +const metricsMockVolMirrURL = APIMockURL + mirrorURL + +const volId = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" func TestClientIMPL_GetCapacity(t *testing.T) { totalSpace0 := 12077448036352 @@ -136,6 +139,20 @@ func TestClientIMPL_PerformanceMetricsByVolume(t *testing.T) { assert.Equal(t, float64(1000), resp[0].TotalIops) } +func TestClientIMPL_VolumeMirrorTransferRate(t *testing.T) { + httpmock.Activate() + defer httpmock.DeactivateAndReset() + setResponder := func(respData string) { + httpmock.RegisterResponder("GET", metricsMockVolMirrURL, + httpmock.NewStringResponder(200, respData)) + } + respData := fmt.Sprintf(`[{"id": "%s"}]`, volId) + setResponder(respData) + volMirr, err := C.VolumeMirrorTransferRate(context.Background(), volId) + assert.Nil(t, err) + assert.Equal(t, volId, volMirr[0].ID) +} + func TestClientIMPL_PerformanceMetricsByCluster(t *testing.T) { httpmock.Activate() defer httpmock.DeactivateAndReset() diff --git a/mocks/Client.go b/mocks/Client.go index 29f745c..9e5482e 100644 --- a/mocks/Client.go +++ b/mocks/Client.go @@ -3711,6 +3711,34 @@ func (_m *Client) PerformanceMetricsByVolume(ctx context.Context, entityID strin return r0, r1 } +func (_m *Client) VolumeMirrorTransferRate(ctx context.Context, entityID string) ([]gopowerstore.VolumeMirrorTransferRateResponse, error) { + ret := _m.Called(ctx, entityID) + + if len(ret) == 0 { + panic("no return value specified for VolumeMirrorTransferRate") + } + + var r0 []gopowerstore.VolumeMirrorTransferRateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) ([]gopowerstore.VolumeMirrorTransferRateResponse, error)); ok { + return rf(ctx, entityID) + } + if rf, ok := ret.Get(0).(func(context.Context, string) []gopowerstore.VolumeMirrorTransferRateResponse); ok { + r0 = rf(ctx, entityID) + } else { + r0 = ret.Get(0).([]gopowerstore.VolumeMirrorTransferRateResponse) + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, entityID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + + // PerformanceMetricsNfsByNode provides a mock function with given fields: ctx, entityID, interval func (_m *Client) PerformanceMetricsNfsByNode(ctx context.Context, entityID string, interval gopowerstore.MetricsIntervalEnum) ([]gopowerstore.PerformanceMetricsByNfsResponse, error) { ret := _m.Called(ctx, entityID, interval) From 2b6287916dcefd33c9f966f1dd81f6210cf5c0cc Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 07:50:01 -0400 Subject: [PATCH 05/11] fix linter --- metrics.go | 7 ++++--- metrics_test.go | 6 ++++-- mocks/Client.go | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/metrics.go b/metrics.go index 6d64616..34bc273 100644 --- a/metrics.go +++ b/metrics.go @@ -25,8 +25,10 @@ import ( "net/http" ) -const metricsURL = "metrics" -const mirrorURL = "volume_mirror_transfer_rate_cma_view" +const ( + metricsURL = "metrics" + mirrorURL = "volume_mirror_transfer_rate_cma_view" +) func (c *ClientIMPL) metricsRequest(ctx context.Context, response interface{}, entity string, entityID string, interval MetricsIntervalEnum) error { _, err := c.APIClient().Query( @@ -68,7 +70,6 @@ func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{ QueryParams: qp, }, response) - if err != nil { err = WrapErr(err) } diff --git a/metrics_test.go b/metrics_test.go index 6e83ff7..0b01757 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -29,8 +29,10 @@ import ( "github.com/stretchr/testify/assert" ) -const metricsMockURL = APIMockURL + metricsURL -const metricsMockVolMirrURL = APIMockURL + mirrorURL +const ( + metricsMockURL = APIMockURL + metricsURL + metricsMockVolMirrURL = APIMockURL + mirrorURL +) const volId = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" diff --git a/mocks/Client.go b/mocks/Client.go index 9e5482e..d138f0d 100644 --- a/mocks/Client.go +++ b/mocks/Client.go @@ -3738,7 +3738,6 @@ func (_m *Client) VolumeMirrorTransferRate(ctx context.Context, entityID string) return r0, r1 } - // PerformanceMetricsNfsByNode provides a mock function with given fields: ctx, entityID, interval func (_m *Client) PerformanceMetricsNfsByNode(ctx context.Context, entityID string, interval gopowerstore.MetricsIntervalEnum) ([]gopowerstore.PerformanceMetricsByNfsResponse, error) { ret := _m.Called(ctx, entityID, interval) @@ -4370,7 +4369,8 @@ func (_m *Client) WearMetricsByDrive(ctx context.Context, entityID string, inter func NewClient(t interface { mock.TestingT Cleanup(func()) -}) *Client { +}, +) *Client { mock := &Client{} mock.Mock.Test(t) From 462d768e279baf48c0ba80716e4dc80de9563da5 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 07:52:11 -0400 Subject: [PATCH 06/11] fix linters --- metrics_test.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/metrics_test.go b/metrics_test.go index 0b01757..39d67f6 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -29,12 +29,10 @@ import ( "github.com/stretchr/testify/assert" ) -const ( - metricsMockURL = APIMockURL + metricsURL - metricsMockVolMirrURL = APIMockURL + mirrorURL -) +const metricsMockURL = APIMockURL + metricsURL +const metricsMockVolMirrURL = APIMockURL + mirrorURL -const volId = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" +const volID = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" func TestClientIMPL_GetCapacity(t *testing.T) { totalSpace0 := 12077448036352 @@ -148,11 +146,11 @@ func TestClientIMPL_VolumeMirrorTransferRate(t *testing.T) { httpmock.RegisterResponder("GET", metricsMockVolMirrURL, httpmock.NewStringResponder(200, respData)) } - respData := fmt.Sprintf(`[{"id": "%s"}]`, volId) + respData := fmt.Sprintf(`[{"id": "%s"}]`, volID) setResponder(respData) - volMirr, err := C.VolumeMirrorTransferRate(context.Background(), volId) + volMirr, err := C.VolumeMirrorTransferRate(context.Background(), volID) assert.Nil(t, err) - assert.Equal(t, volId, volMirr[0].ID) + assert.Equal(t, volID, volMirr[0].ID) } func TestClientIMPL_PerformanceMetricsByCluster(t *testing.T) { From e22d72288c1430b7902e30ec356814c32d1df355 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 07:54:39 -0400 Subject: [PATCH 07/11] fix lint --- metrics_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metrics_test.go b/metrics_test.go index 39d67f6..3a292aa 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -32,7 +32,7 @@ import ( const metricsMockURL = APIMockURL + metricsURL const metricsMockVolMirrURL = APIMockURL + mirrorURL -const volID = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" +const volumeID = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" func TestClientIMPL_GetCapacity(t *testing.T) { totalSpace0 := 12077448036352 @@ -146,11 +146,11 @@ func TestClientIMPL_VolumeMirrorTransferRate(t *testing.T) { httpmock.RegisterResponder("GET", metricsMockVolMirrURL, httpmock.NewStringResponder(200, respData)) } - respData := fmt.Sprintf(`[{"id": "%s"}]`, volID) + respData := fmt.Sprintf(`[{"id": "%s"}]`, volumeID) setResponder(respData) - volMirr, err := C.VolumeMirrorTransferRate(context.Background(), volID) + volMirr, err := C.VolumeMirrorTransferRate(context.Background(), volumeID) assert.Nil(t, err) - assert.Equal(t, volID, volMirr[0].ID) + assert.Equal(t, volumeID, volMirr[0].ID) } func TestClientIMPL_PerformanceMetricsByCluster(t *testing.T) { From 95975b5ed086ea5646d8dc9c6fa393cfccda86f5 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 07:56:33 -0400 Subject: [PATCH 08/11] formatting --- metrics_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/metrics_test.go b/metrics_test.go index 3a292aa..6ce286b 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -29,8 +29,10 @@ import ( "github.com/stretchr/testify/assert" ) -const metricsMockURL = APIMockURL + metricsURL -const metricsMockVolMirrURL = APIMockURL + mirrorURL +const ( + metricsMockURL = APIMockURL + metricsURL + metricsMockVolMirrURL = APIMockURL + mirrorURL +) const volumeID = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" From 04451e6f894b3f291f4bb3bd7a85b339683b8b23 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 08:36:05 -0400 Subject: [PATCH 09/11] unset headers --- metrics.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metrics.go b/metrics.go index 34bc273..6371a1c 100644 --- a/metrics.go +++ b/metrics.go @@ -28,6 +28,7 @@ import ( const ( metricsURL = "metrics" mirrorURL = "volume_mirror_transfer_rate_cma_view" + limit = 2000 ) func (c *ClientIMPL) metricsRequest(ctx context.Context, response interface{}, entity string, entityID string, interval MetricsIntervalEnum) error { @@ -73,6 +74,7 @@ func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{ if err != nil { err = WrapErr(err) } + customHeader.Del("DELL-VISIBILITY") return err } @@ -101,7 +103,7 @@ func (c *ClientIMPL) PerformanceMetricsByVolume(ctx context.Context, entityID st // VolumeMirrorTransferRate - Volume Mirror Transfer Rate func (c *ClientIMPL) VolumeMirrorTransferRate(ctx context.Context, entityID string) ([]VolumeMirrorTransferRateResponse, error) { var resp []VolumeMirrorTransferRateResponse - err := c.mirrorTransferRate(ctx, &resp, entityID, 2000) + err := c.mirrorTransferRate(ctx, &resp, entityID, limit) return resp, err } From 6f83ff99246724aed95073eb35b12a733b396a7d Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 10:26:07 -0400 Subject: [PATCH 10/11] add headers --- metrics.go | 1 + 1 file changed, 1 insertion(+) diff --git a/metrics.go b/metrics.go index 6371a1c..2b27d88 100644 --- a/metrics.go +++ b/metrics.go @@ -75,6 +75,7 @@ func (c *ClientIMPL) mirrorTransferRate(ctx context.Context, response interface{ err = WrapErr(err) } customHeader.Del("DELL-VISIBILITY") + apiClient.SetCustomHTTPHeaders(customHeader) return err } From d07b43a2b4728729a3f3a53cc0de284b1faf0d54 Mon Sep 17 00:00:00 2001 From: nitesh3108 Date: Tue, 8 Oct 2024 10:41:26 -0400 Subject: [PATCH 11/11] copyright update --- metrics.go | 2 +- metrics_test.go | 5 ++--- metrics_types.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/metrics.go b/metrics.go index 2b27d88..e580477 100644 --- a/metrics.go +++ b/metrics.go @@ -1,6 +1,6 @@ /* * - * Copyright © 2020-2022 Dell Inc. or its subsidiaries. All Rights Reserved. + * Copyright © 2020-2024 Dell Inc. or its subsidiaries. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/metrics_test.go b/metrics_test.go index 6ce286b..4df05de 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -1,6 +1,6 @@ /* * - * Copyright © 2020-2022 Dell Inc. or its subsidiaries. All Rights Reserved. + * Copyright © 2020-2024 Dell Inc. or its subsidiaries. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,10 +32,9 @@ import ( const ( metricsMockURL = APIMockURL + metricsURL metricsMockVolMirrURL = APIMockURL + mirrorURL + volumeID = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" ) -const volumeID = "4ffcd8e8-2a93-49ed-b9b3-2e68c8ddc5e4" - func TestClientIMPL_GetCapacity(t *testing.T) { totalSpace0 := 12077448036352 usedSpace0 := 1905262588 diff --git a/metrics_types.go b/metrics_types.go index 9896fd6..cb29b63 100644 --- a/metrics_types.go +++ b/metrics_types.go @@ -1,6 +1,6 @@ /* * - * Copyright © 2020-2022 Dell Inc. or its subsidiaries. All Rights Reserved. + * Copyright © 2020-2024 Dell Inc. or its subsidiaries. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.