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

Expand Statistics support in the C API #11263

Closed
wants to merge 6 commits into from

Conversation

amatveev-cf
Copy link
Contributor

@amatveev-cf amatveev-cf commented Mar 2, 2023

Adds a few missing features to the C API:

  1. Statistics level
  2. Getting individual values instead of a serialized string

Test Plan: unit tests

@amatveev-cf amatveev-cf changed the title Support statistics management via the C API Expand Statistics support in the C API Mar 3, 2023
@amatveev-cf
Copy link
Contributor Author

waiting_skeleton.jpg

@hx235 hx235 requested review from hx235 and removed request for hx235 May 27, 2023 03:38
include/rocksdb/c.h Show resolved Hide resolved
include/rocksdb/c.h Outdated Show resolved Hide resolved
include/rocksdb/c.h Outdated Show resolved Hide resolved
db/c.cc Outdated Show resolved Hide resolved
db/c.cc Show resolved Hide resolved
db/c.cc Show resolved Hide resolved
db/c_test.c Outdated Show resolved Hide resolved
db/c_test.c Show resolved Hide resolved
db/c_test.c Outdated
CheckNoError(err);

rocksdb_options_enable_statistics(options);
rocksdb_options_set_statistics_level(options, 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar suggestion here: use static_cast<uint8_t>(StatsLevel::kAll), assuming by "5", you want to mean StatsLevel::kAll

Copy link
Contributor

Choose a reason for hiding this comment

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

Please see my #11263 (comment)

CheckCondition(0 != rocksdb_options_statistics_get_ticker_count(
options, BYTES_WRITTEN_TICKER));
rocksdb_options_statistics_get_histogram_data(options, DB_WRITE_HIST, hist);
CheckCondition(0 != rocksdb_statistics_histogram_data_get_sum(hist));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also check for other fields rocksdb_statistics_histogram_data_get_*(hist) to be non-zero?

Copy link
Contributor

@hx235 hx235 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 working on this! I left a few comments

db/c.cc Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

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

@hx235 hx235 self-requested a review July 7, 2023 23:52
Copy link
Contributor

@hx235 hx235 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 addressing the previous comments - most of them are resolved. The rest of them, including the follow-up and the open ones, should be easy to address I believe. Thanks!

Added functions for changing statistics level and
collecting tickers and histograms programmatically via the C API
@facebook-github-bot
Copy link
Contributor

@amatveev-cf has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@amatveev-cf has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@amatveev-cf has updated the pull request. You must reimport the pull request before landing.

Copy link
Contributor

@hx235 hx235 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for addressing the comments!!!

@facebook-github-bot
Copy link
Contributor

@amatveev-cf has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@hx235 merged this pull request in 946d100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants