-
Notifications
You must be signed in to change notification settings - Fork 397
feat: show quorum percentage on traces #1143
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
Merged
JuArce
merged 5 commits into
1075-feattelemetry-implement-telemetry-for-aggregator
from
1140-feattelemetry-show-quorum-percentage-on-traces
Oct 2, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
54da939
feat: show quorum percentage on traces
JuArce 5d320c9
fix: push StakeRegistry abi
JuArce 24d10e2
Merge branch 'refs/heads/1075-feattelemetry-implement-telemetry-for-a…
JuArce 1851668
Merge branch 'refs/heads/1075-feattelemetry-implement-telemetry-for-a…
JuArce 3780b98
Merge branch 'refs/heads/1075-feattelemetry-implement-telemetry-for-a…
JuArce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
telemetry_api/lib/telemetry_api/contract_managers/stake_registry.ex
This file contains hidden or 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,48 @@ | ||
| defmodule TelemetryApi.ContractManagers.StakeRegistry do | ||
| alias TelemetryApi.ContractManagers.StakeRegistry | ||
|
|
||
| require Logger | ||
|
|
||
| @aligned_config_file System.get_env("ALIGNED_CONFIG_FILE") | ||
|
|
||
| config_file_path = | ||
| case @aligned_config_file do | ||
| nil -> raise("ALIGNED_CONFIG_FILE not set in .env") | ||
| file -> file | ||
| end | ||
|
|
||
| {status, config_json_string} = File.read(config_file_path) | ||
|
|
||
| case status do | ||
| :ok -> | ||
| Logger.debug("Aligned deployment file read successfully") | ||
|
|
||
| :error -> | ||
| raise("Config file not read successfully") | ||
| end | ||
|
|
||
| @stake_registry_address Jason.decode!(config_json_string) | ||
| |> Map.get("addresses") | ||
| |> Map.get("stakeRegistry") | ||
|
|
||
| use Ethers.Contract, | ||
| abi_file: "priv/abi/IStakeRegistry.json", | ||
| default_address: @stake_registry_address | ||
|
|
||
| @doc """ | ||
| Get the current total stake | ||
| We only use quorum 0 | ||
|
|
||
| ## Examples | ||
|
|
||
| iex> get_current_total_stake() | ||
| {:ok, 100} | ||
|
|
||
| iex> get_current_total_stake() | ||
| {:error, "Error message"} | ||
| """ | ||
| def get_current_total_stake() do | ||
| StakeRegistry.get_current_total_stake(0) | ||
| |> Ethers.call() | ||
| end | ||
| end |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| defmodule TelemetryApi.Traces.Trace do | ||
| @enforce_keys [:parent_span, :context, :responses] | ||
| defstruct [:parent_span, :context, :responses] | ||
| @enforce_keys [:parent_span, :context, :total_stake, :current_stake, :responses] | ||
| defstruct [:parent_span, :context, :total_stake, :current_stake, :responses] | ||
| end |
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.