-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add metrics for counter and time spent on a suave precompile #41
Conversation
@@ -51,6 +54,16 @@ func (p *SuavePrecompiledContractWrapper) Run(input []byte) ([]byte, error) { | |||
}, | |||
} | |||
|
|||
if metrics.EnabledExpensive { | |||
precompileName := artifacts.ResolvePrecompileAddr(p.addr) | |||
metrics.GetOrRegisterMeter("suave/runtime/"+precompileName, nil).Mark(1) |
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.
Feel free to propose another naming for the metric.
@@ -303,9 +303,22 @@ import ( | |||
"github.com/ethereum/go-ethereum/common" | |||
) | |||
|
|||
// List of suave precompile addresses | |||
var ( {{range .Functions}}{{.Name}}Addr = common.HexToAddress("{{.Address}}") |
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.
The same thing is done in #40. Once both things are merged I will consolidate this in a single place.
suave/artifacts/addresses.go
Outdated
"submitEthBlockBidToRelay": submitEthBlockBidToRelayAddr, | ||
} | ||
|
||
func ResolvePrecompileAddr(addr common.Address) string { |
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.
perhaps more explicit could be PrecompileAddressToName
?
📝 Summary
This PR enables metrics to track how many times a SUAVE precompile gets called and how much time does it take to execute it.
📚 References