Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow metrics script to query remote #1160

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions loadtest/scripts/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
import requests
import os
from datetime import datetime, timedelta
import argparse

DATE_TIME_FMT = "%Y-%m-%dT%H:%M:%S.%f"
DEX_MSGS = ["MsgPlaceOrder"]
parser = argparse.ArgumentParser()
parser.add_argument("--node", default="localhost", help="Node base URL")
args = parser.parse_args()
node_base_url = args.node

def get_block_height(tx_hash_str):
res = requests.get(f"http://0.0.0.0:1317/txs/{tx_hash_str}")
res = requests.get(f"http://{node_base_url}:1317/txs/{tx_hash_str}")
body = res.json()
if "height" not in body:
return
Expand All @@ -29,7 +34,7 @@ def get_all_heights():
return sorted(list(seen_heights))

def get_block_info(height):
res = requests.get(f"http://localhost:26657/block?height={height}")
res = requests.get(f"http://{node_base_url}:26657/block?height={height}")
#timestamp: "2023-02-27T23:00:44.214Z"
block = res.json()["block"]
return {
Expand All @@ -46,7 +51,7 @@ def get_block_time(height):
the proto or want to test more modules, we'll need to modify this. However, it works for now.
"""
def get_transaction_breakdown(height):
res = requests.get(f"http://localhost:26657/block?height={height}")
res = requests.get(f"http://{node_base_url}:26657/block?height={height}")
output = res.json()["block"]["data"]["txs"]
tx_mapping = {}
for tx in output:
Expand Down
Loading