Skip to content

Commit

Permalink
feat: optimize metrics query (#1906)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
johnathonroach authored Jun 7, 2022
1 parent 2072397 commit dd8d3bd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/api/src/utils/db-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,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()
Expand Down

0 comments on commit dd8d3bd

Please sign in to comment.