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

fix(metrics): fix missing metrics by installing prometheus before creating db env #6659

Merged

Conversation

sevazhidkov
Copy link
Contributor

@sevazhidkov sevazhidkov commented Feb 18, 2024

This is a suggested alternative fix to a problem introduced in #6573. The previous fix was #6621 (registering metrics on first write vs new).

Problem TLDR: DatabaseEnvMetrics pre-registers all metrics at new, but if metrics recorder isn't available at this point, all future metric writes will NOOP.

This solution here is to register a metric recorder (via dereferencing a lazy static) prior to opening a database environment. Second self.config.install_prometheus_recorder() still remains in the reth node builder to be used in start_metrics_endpoint.

@@ -121,7 +126,6 @@ impl<DB: Database + DatabaseMetrics + DatabaseMetadata + 'static> NodeBuilderWit
let config = self.load_config()?;

let prometheus_handle = self.config.install_prometheus_recorder()?;
info!(target: "reth::cli", "Database opened");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved this, because it seemed misplaced

@shekhirin shekhirin marked this pull request as ready for review February 18, 2024 21:04
@shekhirin shekhirin requested review from mattsse and rkrasiuk and removed request for onbjerg, rakita and joshieDo February 18, 2024 21:04
Copy link
Collaborator

@shekhirin shekhirin left a comment

Choose a reason for hiding this comment

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

I like this approach more than the OnceCell one, but need @mattsse's review to be sure it's okay to do that in the node builder.

@mattsse mattsse added this pull request to the merge queue Feb 18, 2024
Merged via the queue into paradigmxyz:main with commit 79f1fa3 Feb 18, 2024
29 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.

3 participants