Skip to content

[ENH] Tool to inspect the contents of the log. #4757

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rescrv
Copy link
Contributor

@rescrv rescrv commented Jun 4, 2025

Description of changes

Returns the keys that are on the log in order, and the type of log operation.

Test plan

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

N/A

Copy link

github-actions bot commented Jun 4, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor

propel-code-bot bot commented Jun 4, 2025

This PR introduces a new Rust binary, chroma-inspect-log-contents, which connects to a log service and outputs log keys and operation types for a specified collection. It fetches and prints records in batches, providing a simple inspection utility for the log state.

This summary was automatically generated by @propel-code-bot

async fn main() {
let args = std::env::args().skip(1).collect::<Vec<_>>();
if args.len() != 2 {
eprintln!("USAGE: chroma-inspect-log-state [HOST] [COLLECTION_UUID]");
Copy link
Contributor

Choose a reason for hiding this comment

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

[BestPractice]

The error message and command line usage instruction don't match the actual binary name. The error message refers to chroma-inspect-log-state but the binary is named chroma-inspect-log-contents.

"{} {} {} {}",
i as usize + j,
record.log_offset,
record.record.as_ref().map(|r| r.operation).unwrap_or(4),
Copy link
Contributor

Choose a reason for hiding this comment

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

[BestPractice]

Magic number 4 is used for the default operation. Consider using a named constant or referencing the appropriate enum value to make the code more maintainable and understandable.

@rescrv rescrv requested a review from Sicheng-Pan June 6, 2025 15:33
rescrv added 2 commits June 9, 2025 08:28
@rescrv rescrv force-pushed the rescrv/inspect-log-contents branch from ba22817 to fa5645f Compare June 9, 2025 15:29
Copy link
Contributor

@Sicheng-Pan Sicheng-Pan left a comment

Choose a reason for hiding this comment

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

Remember to update the runbook

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