Skip to content
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

Added metric for max gas per transaction #3496

Merged
merged 7 commits into from
Oct 8, 2021

Conversation

bogdan-rosianu
Copy link
Contributor

added erd_max_gas_per_transaction metric that will also be returned in the /network/config endpoint

@bogdan-rosianu bogdan-rosianu added the type:feature New feature or request label Oct 8, 2021
@bogdan-rosianu bogdan-rosianu self-assigned this Oct 8, 2021
@@ -556,7 +557,7 @@ func (nr *nodeRunner) createMetrics(
metrics.SaveStringMetric(managedCoreComponents.StatusHandler(), common.MetricRewardsTopUpGradientPoint, managedCoreComponents.EconomicsData().RewardsTopUpGradientPoint().String())
metrics.SaveStringMetric(managedCoreComponents.StatusHandler(), common.MetricTopUpFactor, fmt.Sprintf("%g", managedCoreComponents.EconomicsData().RewardsTopUpFactor()))
metrics.SaveStringMetric(managedCoreComponents.StatusHandler(), common.MetricGasPriceModifier, fmt.Sprintf("%g", managedCoreComponents.EconomicsData().GasPriceModifier()))

metrics.SaveUint64Metric(managedCoreComponents.StatusHandler(), common.MetricMaxGasPerTransaction, managedCoreComponents.EconomicsData().MaxGasLimitPerMiniBlock(selfShardID))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use managedCoreComponents.EconomicsData().MaxGasLimitPerMiniBlockForSafeCrossShard()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. done

@@ -708,6 +708,8 @@ func (ed *economicsData) setGasLimitConfig(currentEpoch uint32) {
"maxGasLimitPerMetaMiniBlock", ed.maxGasLimitPerMetaMiniBlock,
"minGasLimit", ed.minGasLimit,
)

ed.statusHandler.SetUInt64Value(common.MetricMaxGasPerTransaction, ed.maxGasLimitPerMiniBlock)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MaxGasLimitPerMiniBlockForSafeCrossShard?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot use that function because it has mutex protection and I already am inside a function with mutex protection (until defer). However, I've set the metric value the minimum between shard miniblock limit and meta miniblock limit (just as in that function)

@@ -171,6 +171,7 @@ func (sm *statusMetrics) ConfigMetrics() map[string]interface{} {
configMetrics[common.MetricRewardsTopUpGradientPoint] = sm.loadStringMetric(common.MetricRewardsTopUpGradientPoint)
configMetrics[common.MetricGasPerDataByte] = sm.loadUint64Metric(common.MetricGasPerDataByte)
configMetrics[common.MetricChainId] = sm.loadStringMetric(common.MetricChainId)
configMetrics[common.MetricMaxGasPerTransaction] = sm.loadUint64Metric(common.MetricMaxGasPerTransaction)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this new metric also in the test file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@codecov
Copy link

codecov bot commented Oct 8, 2021

Codecov Report

Merging #3496 (2fa796b) into development (3565a4e) will decrease coverage by 0.00%.
The diff coverage is 66.66%.

❗ Current head 2fa796b differs from pull request most recent head 56d0687. Consider uploading reports for the commit 56d0687 to get more accurate results
Impacted file tree graph

@@               Coverage Diff               @@
##           development    #3496      +/-   ##
===============================================
- Coverage        73.87%   73.87%   -0.01%     
===============================================
  Files              582      582              
  Lines            74441    74444       +3     
===============================================
+ Hits             54996    54998       +2     
- Misses           15044    15045       +1     
  Partials          4401     4401              
Impacted Files Coverage Δ
node/nodeRunner.go 0.00% <0.00%> (ø)
process/economics/economicsData.go 71.24% <100.00%> (+0.07%) ⬆️
statusHandler/statusMetricsProvider.go 65.43% <100.00%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef91386...56d0687. Read the comment docs.

Copy link
Collaborator

@gabi-vuls gabi-vuls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System test passed.
Errors are safe.
image

@gabi-vuls gabi-vuls merged commit d9a983c into development Oct 8, 2021
@gabi-vuls gabi-vuls deleted the added-max-tx-gas-limit-metric branch October 8, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants