Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Fix metrics breakages #1185

Merged
merged 2 commits into from
Mar 28, 2019
Merged

Fix metrics breakages #1185

merged 2 commits into from
Mar 28, 2019

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Mar 28, 2019

PR description

  • Number of metrics labels need to match up with constructor
  • Number of labels must be consistant, so I split it into two metrics
  • Also, naming best practices say that sum() and avg() of a metric
    should be meaningful, separating into two metrics fixes that.
  • fix style issues (finals, intellij warnings)

* Number of metrics labels need to match up with constructor
* Number of labels must be consistant, so I split it into two metrics
* Also, naming best practices say that sum() and avg() of a metric
  should be meaningful, separating into two metrics fixes that.
* fix style issues (finals, intellij warnings)
@shemnon shemnon requested a review from rojotek March 28, 2019 19:17
@shemnon
Copy link
Contributor Author

shemnon commented Mar 28, 2019

This fixes a break at runtime - https://jenkins.pegasys.tech/job/Pantheon%20Benchmarks/job/Pantheon%20Master%20Automatic%20Benchmarks/job/master/583/console
with this stack:

picocli.CommandLine$ExecutionException: Error while running command (tech.pegasys.pantheon.cli.BlocksSubCommand$ImportSubCommand@6034e75d): java.lang.IllegalArgumentException: Incorrect number of labels.
	at picocli.CommandLine.execute(CommandLine.java:1168)
	at picocli.CommandLine.access$800(CommandLine.java:141)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:1367)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:1335)
	at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1243)
	at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526)
	at tech.pegasys.pantheon.cli.ConfigOptionSearchAndRunHandler.handle(ConfigOptionSearchAndRunHandler.java:69)
	at tech.pegasys.pantheon.cli.ConfigOptionSearchAndRunHandler.handle(ConfigOptionSearchAndRunHandler.java:25)
	at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1243)
	at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526)
	at tech.pegasys.pantheon.cli.PantheonCommand.parse(PantheonCommand.java:581)
	at tech.pegasys.pantheon.Pantheon.main(Pantheon.java:38)
Caused by: java.lang.IllegalArgumentException: Incorrect number of labels.
	at io.prometheus.client.SimpleCollector.labels(SimpleCollector.java:64)
	at tech.pegasys.pantheon.metrics.prometheus.PrometheusCounter.labels(PrometheusCounter.java:28)
	at tech.pegasys.pantheon.metrics.prometheus.PrometheusCounter.labels(PrometheusCounter.java:18)
	at tech.pegasys.pantheon.ethereum.core.PendingTransactions.<init>(PendingTransactions.java:79)
	at tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolFactory.createTransactionPool(TransactionPoolFactory.java:34)
	at tech.pegasys.pantheon.controller.MainnetPantheonController.init(MainnetPantheonController.java:151)
	at tech.pegasys.pantheon.controller.PantheonController.fromConfig(PantheonController.java:61)
	at tech.pegasys.pantheon.cli.PantheonControllerBuilder.build(PantheonControllerBuilder.java:109)
	at tech.pegasys.pantheon.cli.PantheonCommand.buildController(PantheonCommand.java:690)
	at tech.pegasys.pantheon.cli.BlocksSubCommand$ImportSubCommand.run(BlocksSubCommand.java:125)
	at picocli.CommandLine.execute(CommandLine.java:1160)
	... 11 more

In a follow-on CL I will investigate not using no-op metrics in test, or making no-op metrics require label counts to match.

Cascading changes to support this in many support classes.  Mostly places
we presumed all NoOpMetrics were equals.
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

LGTM. Only thing I wonder is if we should leave NoOpMetrics as really doing nothing and have a TestMetrics that performs the number-of-labels check.

I guess the other possibility (in a future PR) would be to have variants of LabelledMetric for the number of labels so we get compile time checking. I suspect any metric with more than 3 labels is probably very suspect.

@rojotek
Copy link
Member

rojotek commented Mar 28, 2019

LGTM

@shemnon shemnon merged commit cfcc43c into PegaSysEng:master Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants