From 8175478df4778386e9a982f286ed481975f2825b Mon Sep 17 00:00:00 2001 From: Johnathon Roach Date: Wed, 11 May 2022 08:47:49 -0500 Subject: [PATCH] feat: optimize metrics query This commit optimizes the metrics query to be less brittle in the case that the dimensions array data changes or takes on new values. Here, we query the presence of the keys instead of the exact match of the stringified array. --- packages/api/src/utils/db-client.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/api/src/utils/db-client.js b/packages/api/src/utils/db-client.js index 975c0b85cb..58547ab2d6 100644 --- a/packages/api/src/utils/db-client.js +++ b/packages/api/src/utils/db-client.js @@ -570,10 +570,8 @@ export class DBClient { const dagByteSizeQuery = metricsQuery .select('name, dimensions, value') - .match({ - name: 'dagcargo_project_bytes_in_active_deals', - dimensions: '{{project,nft.storage}}', - }) + .eq('name', 'dagcargo_project_bytes_in_active_deals') + .contains('dimensions', ['project', 'nft.storage']) .single() const weekAgo = new Date()