diff --git a/graph_node_nft_metrics.py b/graph_node_nft_metrics.py index b59870e..e200e98 100644 --- a/graph_node_nft_metrics.py +++ b/graph_node_nft_metrics.py @@ -45,18 +45,21 @@ def get_latest_block(client): def collect_metrics(graph_node): try: get_latest_block(graph_node) - query = gql(f''' - query {{ - marketplace(id:"Marketplace") {{ + query = gql(''' + query { + marketplace(id:"Marketplace") { tokensTotal tokensOnSale totalSold totalVolume - }} - tokens(where: {{price_not: null}}, orderBy: price, orderDirection: asc, first: 1) {{ + } + tokens(where: {price_not: null}, orderBy: price, orderDirection: asc, first: 1) { price - }} - }} + } + accounts(where: {tokensTotal_gt: "0"}) { + id + } + } ''') response = graph_node.execute(query) @@ -71,6 +74,9 @@ def collect_metrics(graph_node): floor_price = tokens[0]['price'] NFTS_FLOOR_PRICE.set(floor_price) + holders = response['accounts'] + NFT_HOLDERS_TOTAL.set(len(holders)) + except Exception as e: logger.error(f"Error in collecting NFT metrics from graph-node: {e}") raise () diff --git a/metrics.py b/metrics.py index efef0bf..a176c0e 100644 --- a/metrics.py +++ b/metrics.py @@ -53,3 +53,4 @@ NFTS_TOTAL_SOLD = Gauge("fluence_network_nfts_total_sold", "Total count of NFTs sold", registry=registry) NFTS_TOTAL_VOLUME = Gauge("fluence_network_nfts_total_volume", "Total volume of NFTs", registry=registry) NFTS_FLOOR_PRICE = Gauge("fluence_network_nfts_floor_price", "Floor price of NFTs", registry=registry) +NFT_HOLDERS_TOTAL = Gauge("fluence_network_nft_holders_total", "Total count of NFT holders", registry=registry)