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

Add runtime histogram metric #160

Merged
merged 14 commits into from
Oct 22, 2024
Merged

Conversation

KatyaRyazantseva
Copy link

@KatyaRyazantseva KatyaRyazantseva commented Oct 3, 2024

PR Description

Add histogram timer and beacon_data_column_sidecar_gossip_verification_seconds PeerDAS metric

Fixed Issue(s)

fixes #65

import org.hyperledger.besu.plugin.services.MetricsSystem;
import org.hyperledger.besu.plugin.services.metrics.MetricCategory;

public class SettableHistogram {
Copy link
Collaborator

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;
Copy link
Collaborator

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) {
Copy link
Collaborator

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'))
Copy link
Collaborator

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) {
Copy link
Collaborator

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();
    }
  }

Copy link
Collaborator

@zilm13 zilm13 left a 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) {
Copy link
Collaborator

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;
Copy link
Collaborator

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);
Copy link
Collaborator

@zilm13 zilm13 Oct 22, 2024

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);

@zilm13 zilm13 marked this pull request as ready for review October 22, 2024 18:42
@zilm13 zilm13 merged commit 25616ec into Nashatyrev:das Oct 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants