[#29] Add delete metrics
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
9501e300c1
commit
f6695f3b4c
4 changed files with 23 additions and 3 deletions
|
@ -137,6 +137,9 @@ func (c *Client) Delete(containerID string, objectID string) DeleteResponse {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stats.Report(c.vu, objDeleteTotal, 1)
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
var prm client.PrmObjectDelete
|
var prm client.PrmObjectDelete
|
||||||
prm.ByID(cliObjectID)
|
prm.ByID(cliObjectID)
|
||||||
prm.FromContainer(cliContainerID)
|
prm.FromContainer(cliContainerID)
|
||||||
|
@ -144,9 +147,11 @@ func (c *Client) Delete(containerID string, objectID string) DeleteResponse {
|
||||||
|
|
||||||
_, err = c.cli.ObjectDelete(c.vu.Context(), prm)
|
_, err = c.cli.ObjectDelete(c.vu.Context(), prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
stats.Report(c.vu, objDeleteFails, 1)
|
||||||
return DeleteResponse{Success: false, Error: err.Error()}
|
return DeleteResponse{Success: false, Error: err.Error()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stats.Report(c.vu, objDeleteDuration, metrics.D(time.Since(start)))
|
||||||
return DeleteResponse{Success: true}
|
return DeleteResponse{Success: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ var (
|
||||||
|
|
||||||
objPutTotal, objPutFails, objPutDuration *metrics.Metric
|
objPutTotal, objPutFails, objPutDuration *metrics.Metric
|
||||||
objGetTotal, objGetFails, objGetDuration *metrics.Metric
|
objGetTotal, objGetFails, objGetDuration *metrics.Metric
|
||||||
|
objDeleteTotal, objDeleteFails, objDeleteDuration *metrics.Metric
|
||||||
cnrPutTotal, cnrPutFails, cnrPutDuration *metrics.Metric
|
cnrPutTotal, cnrPutFails, cnrPutDuration *metrics.Metric
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -116,6 +117,10 @@ func (n *Native) Connect(endpoint, hexPrivateKey string) (*Client, error) {
|
||||||
objGetFails, _ = registry.NewMetric("neofs_obj_get_fails", metrics.Counter)
|
objGetFails, _ = registry.NewMetric("neofs_obj_get_fails", metrics.Counter)
|
||||||
objGetDuration, _ = registry.NewMetric("neofs_obj_get_duration", metrics.Trend, metrics.Time)
|
objGetDuration, _ = registry.NewMetric("neofs_obj_get_duration", metrics.Trend, metrics.Time)
|
||||||
|
|
||||||
|
objDeleteTotal, _ = registry.NewMetric("neofs_obj_delete_total", metrics.Counter)
|
||||||
|
objDeleteFails, _ = registry.NewMetric("neofs_obj_delete_fails", metrics.Counter)
|
||||||
|
objDeleteDuration, _ = registry.NewMetric("neofs_obj_delete_duration", metrics.Trend, metrics.Time)
|
||||||
|
|
||||||
cnrPutTotal, _ = registry.NewMetric("neofs_cnr_put_total", metrics.Counter)
|
cnrPutTotal, _ = registry.NewMetric("neofs_cnr_put_total", metrics.Counter)
|
||||||
cnrPutFails, _ = registry.NewMetric("neofs_cnr_put_fails", metrics.Counter)
|
cnrPutFails, _ = registry.NewMetric("neofs_cnr_put_fails", metrics.Counter)
|
||||||
cnrPutDuration, _ = registry.NewMetric("neofs_cnr_put_duration", metrics.Trend, metrics.Time)
|
cnrPutDuration, _ = registry.NewMetric("neofs_cnr_put_duration", metrics.Trend, metrics.Time)
|
||||||
|
|
|
@ -72,14 +72,19 @@ func (c *Client) Put(bucket, key string, payload goja.ArrayBuffer) PutResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Delete(bucket, key string) DeleteResponse {
|
func (c *Client) Delete(bucket, key string) DeleteResponse {
|
||||||
|
stats.Report(c.vu, objDeleteTotal, 1)
|
||||||
|
start := time.Now()
|
||||||
|
|
||||||
_, err := c.cli.DeleteObject(c.vu.Context(), &s3.DeleteObjectInput{
|
_, err := c.cli.DeleteObject(c.vu.Context(), &s3.DeleteObjectInput{
|
||||||
Bucket: aws.String(bucket),
|
Bucket: aws.String(bucket),
|
||||||
Key: aws.String(key),
|
Key: aws.String(key),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
stats.Report(c.vu, objDeleteFails, 1)
|
||||||
return DeleteResponse{Success: false, Error: err.Error()}
|
return DeleteResponse{Success: false, Error: err.Error()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stats.Report(c.vu, objDeleteDuration, metrics.D(time.Since(start)))
|
||||||
return DeleteResponse{Success: true}
|
return DeleteResponse{Success: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ var (
|
||||||
|
|
||||||
objPutTotal, objPutFails, objPutDuration *metrics.Metric
|
objPutTotal, objPutFails, objPutDuration *metrics.Metric
|
||||||
objGetTotal, objGetFails, objGetDuration *metrics.Metric
|
objGetTotal, objGetFails, objGetDuration *metrics.Metric
|
||||||
|
objDeleteTotal, objDeleteFails, objDeleteDuration *metrics.Metric
|
||||||
createBucketTotal, createBucketFails, createBucketDuration *metrics.Metric
|
createBucketTotal, createBucketFails, createBucketDuration *metrics.Metric
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -75,6 +76,10 @@ func (s *S3) Connect(endpoint string) (*Client, error) {
|
||||||
objGetFails, _ = registry.NewMetric("aws_obj_get_fails", metrics.Counter)
|
objGetFails, _ = registry.NewMetric("aws_obj_get_fails", metrics.Counter)
|
||||||
objGetDuration, _ = registry.NewMetric("aws_obj_get_duration", metrics.Trend, metrics.Time)
|
objGetDuration, _ = registry.NewMetric("aws_obj_get_duration", metrics.Trend, metrics.Time)
|
||||||
|
|
||||||
|
objDeleteTotal, _ = registry.NewMetric("aws_obj_delete_total", metrics.Counter)
|
||||||
|
objDeleteFails, _ = registry.NewMetric("aws_obj_delete_fails", metrics.Counter)
|
||||||
|
objDeleteDuration, _ = registry.NewMetric("aws_obj_delete_duration", metrics.Trend, metrics.Time)
|
||||||
|
|
||||||
createBucketTotal, _ = registry.NewMetric("aws_create_bucket_total", metrics.Counter)
|
createBucketTotal, _ = registry.NewMetric("aws_create_bucket_total", metrics.Counter)
|
||||||
createBucketFails, _ = registry.NewMetric("aws_create_bucket_fails", metrics.Counter)
|
createBucketFails, _ = registry.NewMetric("aws_create_bucket_fails", metrics.Counter)
|
||||||
createBucketDuration, _ = registry.NewMetric("aws_create_bucket_duration", metrics.Trend, metrics.Time)
|
createBucketDuration, _ = registry.NewMetric("aws_create_bucket_duration", metrics.Trend, metrics.Time)
|
||||||
|
|
Loading…
Reference in a new issue