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 fetchMetrics API to BaseStatsReporter #10178

Closed

Conversation

majetideepak
Copy link
Collaborator

@majetideepak majetideepak commented Jun 13, 2024

Return the aggregated metrics in a serialized string format.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 13, 2024
Copy link

netlify bot commented Jun 13, 2024

Deploy Preview for meta-velox ready!

Name Link
🔨 Latest commit 4a0da68
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/667117c6af07d10008ebd534
😎 Deploy Preview https://deploy-preview-10178--meta-velox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@majetideepak
Copy link
Collaborator Author

@tanjialiang can you help review/land this change? Thanks!

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@majetideepak why we need this? thanks!

@majetideepak
Copy link
Collaborator Author

majetideepak commented Jun 14, 2024

@xiaoxmeng We need this to simplify the prometheus metrics implementation in Presto.
See @tanjialiang's comment here prestodb/presto#22360 (comment).
Without this, we need to add a custom implementation something like.

std::string getSerializedMetrics() {
  if (auto reporter =
          std::dynamic_pointer_cast<prometheus::PrometheusStatsReporter>(
              folly::Singleton<velox::BaseStatsReporter>::try_get())) {
    return reporter->getSerializedMetrics();
  } else if (...) {
  }
  VELOX_UNREACHABLE("No metrics reporter is enabled");
}

@majetideepak
Copy link
Collaborator Author

@xiaoxmeng, @tanjialiang any thoughts on this API? Thanks!

Copy link
Contributor

@tanjialiang tanjialiang left a comment

Choose a reason for hiding this comment

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

Thanks for the change. Some minor issues.

@@ -135,6 +135,9 @@ class BaseStatsReporter {
virtual void addHistogramMetricValue(folly::StringPiece key, size_t value)
const = 0;

/// Return the metrics in a serialized string format.
Copy link
Contributor

Choose a reason for hiding this comment

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

/// Return the aggregated metrics in a serialized string format.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if this API should be const. Depending on implementations, clean-like operations can happen inside per each fetch interval.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense to remove the const. I address the comments. Thanks!

@facebook-github-bot
Copy link
Contributor

@tanjialiang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@tanjialiang merged this pull request in 0fe2e62.

Copy link

Conbench analyzed the 1 benchmark run on commit 0fe2e621.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

@majetideepak majetideepak deleted the fetchmetrics branch June 21, 2024 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants