-
Notifications
You must be signed in to change notification settings - Fork 0
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 runtime histogram metric #160
Conversation
import org.hyperledger.besu.plugin.services.MetricsSystem; | ||
import org.hyperledger.besu.plugin.services.metrics.MetricCategory; | ||
|
||
public class SettableHistogram { |
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.
I'd call it MetricsHistogram
and rename current MetricsHistogram
to MetricsQuantileHistogram
String name, | ||
String help, | ||
double... buckets) { | ||
this.name = name; |
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.
Just this(metricsSystem, category, name, help, new String[0], buckets);
would do all job without duplicating
} | ||
} | ||
|
||
protected Collector histogramToCollector(final MetricCategory metricCategory, final String name) { |
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.
Please, remove unused inputs
@@ -25,7 +25,11 @@ dependencies { | |||
implementation project(':storage') | |||
implementation project(':storage:api') | |||
|
|||
implementation testFixtures(project(':infrastructure:metrics')) |
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.
please remove all new implementations, we will avoid exposing anything outside of infrastructure:metrics
instead
} | ||
} | ||
|
||
public Timer startTimer(String... labelValues) { |
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.
To avoid exposing prometheus timer outside, let's wrap it here. Make inner class like this, and return it here
public record Timer(Histogram.Timer delegate) implements Closeable {
@Override
public void close() throws IOException {
delegate.close();
}
}
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.
LGTM, will approve and merge after changes
DataColumnSidecarGossipValidator validator, DasGossipLogger dasGossipLogger) { | ||
DataColumnSidecarGossipValidator validator, | ||
DasGossipLogger dasGossipLogger, | ||
MetricsSystem metricsSystem) { |
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.
finals please
listener -> listener.onNewValidSidecar(dataColumnSidecar)); | ||
} | ||
}); | ||
SafeFuture<InternalValidationResult> validation; |
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.
final please
try (Timer ignored = histogram.startTimer()) { | ||
validation = validator.validate(dataColumnSidecar); | ||
} catch (final Throwable t) { | ||
LOG.error("Failed to validate data column sidecar", t); |
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.
Let's log datacolumnsidecar too.Something like this
LOG.error("Failed to validate data column sidecar {}", dataColumnSidecar::toLogString, () -> t);
PR Description
Add histogram timer and
beacon_data_column_sidecar_gossip_verification_seconds
PeerDAS metricFixed Issue(s)
fixes #65