-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from mfactory-lab/develop
repair tds stats
- Loading branch information
Showing
8 changed files
with
91 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import time | ||
import solana_rpc as rpc | ||
from common import debug | ||
from common import ValidatorConfig | ||
import statistics | ||
import numpy as np | ||
import tds_info as tds | ||
from common import measurement_from_fields | ||
|
||
def load_data(config: ValidatorConfig): | ||
identity_account_pubkey = rpc.load_identity_account_pubkey(config) | ||
default = [] | ||
tds_data = default | ||
tds_data = tds.load_tds_info(config, identity_account_pubkey) | ||
|
||
result = { | ||
'identity_account_pubkey': identity_account_pubkey, | ||
'tds_data': tds_data | ||
} | ||
|
||
debug(config, str(result)) | ||
|
||
return result | ||
|
||
def calculate_influx_fields(data): | ||
if data is None: | ||
result = {"tds_info": 0} | ||
else: | ||
identity_account_pubkey = data['identity_account_pubkey'] | ||
|
||
result = data['tds_data'] | ||
return result | ||
|
||
def calculate_output_data(config: ValidatorConfig): | ||
data = load_data(config) | ||
|
||
tags = { | ||
"validator_identity_pubkey": data['identity_account_pubkey'], | ||
"validator_name": config.validator_name, | ||
"cluster_environment": config.cluster_environment | ||
} | ||
|
||
|
||
measurement = measurement_from_fields( | ||
"tds_info", | ||
calculate_influx_fields(data), | ||
tags, | ||
config | ||
) | ||
return measurement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from monitoring_config import config | ||
from measurement_tds_info import calculate_output_data | ||
from common import print_json | ||
|
||
print_json(calculate_output_data(config)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters