From 9212cefb0e0302314d829e99ae13bf9bf03120e9 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 16 Feb 2023 18:58:45 +0300 Subject: [PATCH] [#9] scenarios: Unify error log entries Signed-off-by: Evgenii Stratonikov --- scenarios/grpc.js | 6 +++--- scenarios/http.js | 4 ++-- scenarios/s3.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scenarios/grpc.js b/scenarios/grpc.js index a989021..950389d 100644 --- a/scenarios/grpc.js +++ b/scenarios/grpc.js @@ -118,7 +118,7 @@ export function obj_write() { const { payload, hash } = generator.genPayload(registry_enabled); const resp = grpc_client.put(container, headers, payload); if (!resp.success) { - log.withField("cid", container).info(resp.error); + log.withField("cid", container).error(resp.error); return; } @@ -135,7 +135,7 @@ export function obj_read() { const obj = obj_list[Math.floor(Math.random() * obj_list.length)]; const resp = grpc_client.get(obj.container, obj.object) if (!resp.success) { - log.withFields({cid: obj.container, oid: obj.object}).info(resp.error); + log.withFields({cid: obj.container, oid: obj.object}).error(resp.error); } } @@ -152,7 +152,7 @@ export function obj_delete() { const resp = grpc_client.delete(obj.c_id, obj.o_id); if (!resp.success) { // Log errors except (2052 - object already deleted) - log.withFields({cid: obj.c_id, oid: obj.o_id}).info(resp.error); + log.withFields({cid: obj.c_id, oid: obj.o_id}).error(resp.error); return; } diff --git a/scenarios/http.js b/scenarios/http.js index b48d251..9e4493b 100644 --- a/scenarios/http.js +++ b/scenarios/http.js @@ -87,7 +87,7 @@ export function obj_write() { const resp = http.post(`http://${http_endpoint}/upload/${container}`, data); if (resp.status != 200) { - log.info(`ERROR: ${resp.status} ${resp.error}`); + log.withFields({status: resp.status, cid: container}).error(resp.error); return; } const object_id = JSON.parse(resp.body).object_id; @@ -104,7 +104,7 @@ export function obj_read() { const obj = obj_list[Math.floor(Math.random() * obj_list.length)]; const resp = http.get(`http://${http_endpoint}/get/${obj.container}/${obj.object}`); if (resp.status != 200) { - log.info(`ERROR reading ${obj.object}: ${resp.status}`); + log.withFields({status: resp.status, cid: obj.container, oid: obj.object}).error(resp.error); } } diff --git a/scenarios/s3.js b/scenarios/s3.js index 8827331..9da19d2 100644 --- a/scenarios/s3.js +++ b/scenarios/s3.js @@ -114,7 +114,7 @@ export function obj_write() { const { payload, hash } = generator.genPayload(registry_enabled); const resp = s3_client.put(bucket, key, payload); if (!resp.success) { - log.info(resp.error); + log.withFields({bucket: bucket, key: key}).error(resp.error); return; } @@ -132,7 +132,7 @@ export function obj_read() { const resp = s3_client.get(obj.bucket, obj.object); if (!resp.success) { - log.info(resp.error); + log.withFields({bucket: obj.bucket, key: obj.object}).error(resp.error); } } @@ -148,7 +148,7 @@ export function obj_delete() { const resp = s3_client.delete(obj.s3_bucket, obj.s3_key); if (!resp.success) { - log.info(`Error deleting object ${obj.id}: ${resp.error}`); + log.withFields({bucket: obj.s3_bucket, key: obj.s3_key, op: "DELETE"}).error(resp.error); return; }