-
Notifications
You must be signed in to change notification settings - Fork 2
collect metrics on relay success and latency #67
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
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
62f2a27
feat(ift): extend catalyst to support IFT messages
johnnylarner bf98281
feat(ift): add evm -> cosmos and evm -> evm to ift
johnnylarner 543ac95
refactor: implement review comments
johnnylarner e8e6322
add relayer submission retry logic and some bug fixes around timestam…
dhfang 5d8a031
refactor: replace SentTx.Err with derived Failed()/Error() methods
dhfang 2ee5c35
refactor: remove txMode, integrate IFT into TxFactory, add explicit r…
dhfang e3d3e83
refactor: rename SentTx error fields and clean up evm relay flow
dhfang fd35a75
increase relay timeout
dhfang 11bf984
remove unused Failed/Error methods on ethereum SentTx
dhfang a389c92
merge main into plat-374/extended-ift-transfer-integration-test
dhfang 0335731
fix lint issues
dhfang 8e4be5b
fix struct tag formatting in ChainConfig
dhfang 426d986
relayer failures are surfaced as a separate metric in stats
dhfang 5263ff3
address greptile feedback and fix golines lint
dhfang 3f2c7c9
collect metrics on relay success and latency
dhfang 2592c3d
Merge remote-tracking branch 'origin/main' into df/relay-metrics
dhfang 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
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
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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package relayer | ||
|
|
||
| import "github.com/prometheus/client_golang/prometheus" | ||
|
|
||
| const ( | ||
| promNamespace = "catalyst" | ||
| promSubsystem = "relay" | ||
| ) | ||
|
|
||
| type Metrics struct { | ||
| Success *prometheus.CounterVec | ||
| Failure *prometheus.CounterVec | ||
| Duration *prometheus.HistogramVec | ||
| } | ||
|
|
||
| // NewMetrics constructs and registers the relay metric vectors. Pass the | ||
| // result to NewGRPCClient; pass nil to disable instrumentation entirely. | ||
| func NewMetrics() *Metrics { | ||
| m := &Metrics{ | ||
| Success: prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
| Namespace: promNamespace, | ||
| Subsystem: promSubsystem, | ||
| Name: "success_total", | ||
| Help: "Tx hashes successfully submitted to the relayer (terminal, per submission).", | ||
| }, []string{"chain_id"}), | ||
| Failure: prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
| Namespace: promNamespace, | ||
| Subsystem: promSubsystem, | ||
| Name: "failure_total", | ||
| Help: "Tx hashes that failed to be submitted to the relayer after all retries.", | ||
| }, []string{"chain_id"}), | ||
| Duration: prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
| Namespace: promNamespace, | ||
| Subsystem: promSubsystem, | ||
| Name: "duration_seconds", | ||
| Help: "Duration of a single gRPC relay request (per-attempt, not including retry backoff).", | ||
| Buckets: []float64{0.01, 0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10}, | ||
| }, []string{"chain_id"}), | ||
| } | ||
| prometheus.MustRegister(m.Success, m.Failure, m.Duration) | ||
| return m | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MustRegisterpanics on duplicate registrationprometheus.MustRegisterpanics if the same metric name is registered twice in the default global registry. IfNewMetrics()is called more than once in the same process — for example, in integration tests that instantiate a runner for each test case — the second call will panic. Consider usingprometheus.Registerwith an already-registered check, or accepting aprometheus.Registereras a parameter so callers can use isolated registries for tests.