Skip to content

Commit ee6d034

Browse files
committed
Add new labels: integration_maturity, canonical_name and chain_selector
1 parent a272dd6 commit ee6d034

23 files changed

+80
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ local*
1515
# Python
1616
venv
1717
__pycache__
18+
.coverage

config/exporter_example/config.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "Example Chain" # Name of blockchain i.e "Ethereum"
22
chain_id: 1 # Chain ID, can be found at https://chainlist.org/
33
network_name: "Example" # Name of the blokckchain network i.e Rinkeby
44
network_type: "Example" # Type of the blockchain network, only two values allowed (Mainnet|Testnet)
5+
integration_maturity: "development" # Integration Maturity - (production|development)
6+
canonical_name: "example-chain-testnet" # Canonical name as set by BIX
7+
chain_selector: 121212 # CCIP chain selector, use -1 if absent
58
connection_parameters:
69
open_timeout: 6 # Timeout when opening websocket connection
710
close_timeout: 1 # Timeout when closing websocket connection
@@ -11,7 +14,7 @@ connection_parameters:
1114
collector: "evm" # This will load different collectors based on what mode exporter will run with Supported modes are: "evm", "solana", "conflux", "cardano", "bitcoin"
1215
endpoints: # List of endpoints with their metadata.
1316
- url: wss://example-rpc-1.com/ws # RPC Endpoint websocket endpoint (Must start with wss:// or https://)
14-
provider: Provider1 # Provider (Must be present in allowed providers list. Please check src/settings.py line 24) The purpose is to make sure we do not have same providers spelled differently
17+
provider: Provider1 # Provider (Must be present in allowed providers list. Please check src/settings.py line 24) The purpose is to make sure we do not have same providers spelled differently
1518
- url: wss://example-rpc-2.com/ws
1619
provider: Provider2
1720
- url: wss://example-rpc-3.com/ws
@@ -25,4 +28,4 @@ endpoints: # List of endpoints with their metadata.
2528

2629

2730

28-
##
31+
##

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pytest==7.2.1
2-
pylint==2.16.2
2+
pylint==3.3.1
33
coverage==7.1.0
44
requests==2.28.2
55
requests_mock==1.10.0

src/configuration.py

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def _load_configuration(self):
5959
And(str),
6060
'network_type':
6161
And(str, lambda s: s in ('Testnet', 'Mainnet')),
62+
'integration_maturity':
63+
And(str, lambda s: s in ('production', 'development')),
64+
'canonical_name':
65+
And(str),
66+
'chain_selector':
67+
And(int),
6268
'collector':
6369
And(str, lambda s: s in supported_collectors),
6470
Optional('connection_parameters'): {

src/exporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def exporter(environ, start_fn): # pylint: disable=inconsistent-return-statemen
2020
"""Web-server endpoints routing."""
2121
match environ['PATH_INFO']:
2222
case '/metrics':
23-
return metrics_app(environ, start_fn)
23+
return metrics_app(environ, start_fn) # pylint: disable=possibly-used-before-assignment
2424
case _:
2525
return return404(environ, start_fn)
2626

src/metrics.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class MetricsLoader():
1212
def __init__(self):
1313
self._labels = [
1414
'url', 'provider', 'blockchain', 'network_name', 'network_type',
15+
'integration_maturity', 'canonical_name', 'chain_selector',
1516
'evmChainID'
1617
]
1718

src/registries.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
class Endpoint(): # pylint: disable=too-few-public-methods
1010
"""RPC Endpoint class, to store metadata."""
1111

12-
def __init__( # pylint: disable=too-many-arguments
13-
self, url, provider, blockchain, network_name, network_type,
12+
def __init__( # pylint: disable=too-many-arguments,too-many-positional-arguments
13+
self, url, provider, blockchain, network_name, network_type, integration_maturity,
14+
canonical_name, chain_selector,
1415
chain_id, **client_parameters):
1516
self.url = url
1617
self.chain_id = chain_id
1718
self.labels = [
18-
url, provider, blockchain, network_name, network_type,
19+
url, provider, blockchain, network_name, network_type, integration_maturity,
20+
canonical_name, str(chain_selector),
1921
str(chain_id)
2022
]
2123
self.client_parameters = client_parameters
@@ -50,6 +52,9 @@ def get_endpoint_registry(self) -> list:
5052
self.blockchain,
5153
self.get_property('network_name'),
5254
self.get_property('network_type'),
55+
self.get_property('integration_maturity'),
56+
self.get_property('canonical_name'),
57+
self.get_property('chain_selector'),
5358
self.get_property('chain_id'),
5459
**self.client_parameters))
5560
return endpoints_list

src/test_configuration.py

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ def test_configuration_attribute(self):
5050
"TestNetwork",
5151
"network_type":
5252
"Mainnet",
53+
"integration_maturity":
54+
"development",
55+
"canonical_name":
56+
"test-network-mainnet",
57+
"chain_selector":
58+
121212,
5359
"collector":
5460
"evm",
5561
"endpoints": [{

src/test_metrics.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ class TestMetricsLoader(TestCase):
1313
def setUp(self):
1414
self.metrics_loader = MetricsLoader()
1515
self.labels = [
16-
'url', 'provider', 'blockchain', 'network_name', 'network_type', 'evmChainID'
16+
'url', 'provider', 'blockchain', 'network_name', 'network_type',
17+
'integration_maturity', 'canonical_name', 'chain_selector',
18+
'evmChainID'
1719
]
1820

1921
def test_labels(self):

src/test_registries.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ def setUp(self):
1717
self.blockchain = "test_chain"
1818
self.network_name = "test_network"
1919
self.network_type = "ETH"
20+
self.integration_maturity = "development"
21+
self.canonical_name = "test-chain-network"
22+
self.chain_selector = 121212
2023
self.chain_id = 123
2124
self.client_params = {"dummy": "data"}
2225
self.endpoint = Endpoint(self.url, self.provider, self.blockchain,
2326
self.network_name, self.network_type,
27+
self.integration_maturity, self.canonical_name,
28+
self.chain_selector,
2429
self.chain_id, **self.client_params)
2530

2631
def test_url_attribute(self):
@@ -34,7 +39,10 @@ def test_chain_id_attribute(self):
3439
def test_labels_attribute(self):
3540
"""Tests the labels attribute is set correctly"""
3641
labels = [self.url, self.provider, self.blockchain,
37-
self.network_name, self.network_type, str(self.chain_id)]
42+
self.network_name, self.network_type,
43+
self.integration_maturity, self.canonical_name,
44+
str(self.chain_selector),
45+
str(self.chain_id)]
3846
self.assertEqual(labels, self.endpoint.labels)
3947

4048

src/tests/fixtures/configuration.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "TestChain"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "evm"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_aptos.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "Aptos"
22
chain_id: 1234
33
network_name: "Testnet"
44
network_type: "Testnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-testnet"
7+
chain_selector: 121212
58
collector: "aptos"
69
endpoints:
710
- url: https://test1.com

src/tests/fixtures/configuration_bitcoin.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "Bitcoin"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "bitcoin"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_cardano.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "cardano"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "cardano"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_conflux.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "conflux"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "conflux"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_conn_params.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "TestChain"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "evm"
69
connection_parameters:
710
open_timeout: 1

src/tests/fixtures/configuration_evm.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "other"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "evm"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_filecoin.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "filecoin"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "filecoin"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_invalid.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "TestChain"
22
chain_id: '1234' # str instead of int
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "evm"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_solana.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "solana"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "solana"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_starknet.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "starknet"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "starknet"
69
endpoints:
710
- url: wss://test1.com

src/tests/fixtures/configuration_tron.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "Tron"
22
chain_id: 1234
33
network_name: "Testnet"
44
network_type: "Testnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-testnet"
7+
chain_selector: 121212
58
collector: "tron"
69
endpoints:
710
- url: https://test1.com

src/tests/fixtures/configuration_unsupported_blockchain.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ blockchain: "bitcoin"
22
chain_id: 1234
33
network_name: "TestNetwork"
44
network_type: "Mainnet"
5+
integration_maturity: "development"
6+
canonical_name: "test-network-mainnet"
7+
chain_selector: 121212
58
collector: "cardano"
69
endpoints:
710
- url: wss://test1.com

0 commit comments

Comments
 (0)