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

feat: add --metrics [flag] to forest #3609

Merged
merged 4 commits into from
Oct 20, 2023
Merged

feat: add --metrics [flag] to forest #3609

merged 4 commits into from
Oct 20, 2023

Conversation

hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Oct 18, 2023

Summary of changes

Adding an option to disable metrics endpoint (just like for RPC endpoint) to facilitate writing simple test for #3593

Changes introduced in this pull request:

  • add --metrics [flag] to forest to control the availability of the Prometheus server

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@hanabi1224 hanabi1224 marked this pull request as ready for review October 18, 2023 14:12
@hanabi1224 hanabi1224 requested a review from a team as a code owner October 18, 2023 14:12
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and jdjaustin and removed request for a team October 18, 2023 14:12
Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

The usage now would be --metrics false and --metrics true, while a possibility, would never be used. How about --disable-metrics boolean? Or --no-metrics.

@hanabi1224
Copy link
Contributor Author

hanabi1224 commented Oct 19, 2023

The usage now would be --metrics false and --metrics true, while a possibility, would never be used. How about --disable-metrics boolean? Or --no-metrics.

@LesnyRumcajs It makes sense, using --metrics [true|false] is to align with the existing --rpc [true|false] option. Do you suggest changing only this one or both?

@LesnyRumcajs
Copy link
Member

We should change both for consistency, but in separate PRs.

@hanabi1224
Copy link
Contributor Author

We should change both for consistency, but in separate PRs.

@LesnyRumcajs Changed to --no-metrics

Comment on lines +193 to 200
if self.no_metrics {
cfg.client.enable_metrics_endpoint = false;
} else {
cfg.client.enable_metrics_endpoint = true;
if let Some(metrics_address) = self.metrics_address {
cfg.client.metrics_address = metrics_address;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

A bit of code-golf if you wish

Suggested change
if self.no_metrics {
cfg.client.enable_metrics_endpoint = false;
} else {
cfg.client.enable_metrics_endpoint = true;
if let Some(metrics_address) = self.metrics_address {
cfg.client.metrics_address = metrics_address;
}
}
cfg.client.enable_metrics_endpoint = !self.no_metrics;
cfg.client.metrics_address = self.metrics_address.unwrap_or(cfg.client.metrics_address);

@hanabi1224 hanabi1224 added this pull request to the merge queue Oct 20, 2023
Merged via the queue into main with commit 0dd8211 Oct 20, 2023
23 checks passed
@hanabi1224 hanabi1224 deleted the hm/metrics-option branch October 20, 2023 08:34
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.

None yet

3 participants