Skip to content

Conversation

@zah
Copy link
Member

@zah zah commented May 19, 2025

Summary

  • add --out-dir option for tracer utilities
  • default to CODETRACER_RUBY_RECORDER_OUT_DIR or current dir
  • rename env variable in code, docs and tests
  • document new usage and env var in README

Testing

  • just test
  • just bench
  • just build-extension

README.md Outdated
* if you pass `CODETRACER_RUBY_TRACER_DEBUG=1`, you enables some additional debug-related logging
* `CODETRACER_DB_TRACE_PATH` can be used to override the path to `trace.json` (it's used internally by codetracer as well)
* `CODETRACER_RUBY_RECORDER_OUT_DIR` can be used to specify the directory for trace files
(used internally by codetracer as well; defaults to the current directory)
Copy link
Member

Choose a reason for hiding this comment

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

it's not used internally: is this connected to a codetracer PR?

Copy link
Member Author

@zah zah May 19, 2025

Choose a reason for hiding this comment

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

It was renamed to establish consistency with the CLI option name and to define a convention that we can use in all future recorder projects (e.g. the Python recorder will use CODETRACER_PYTHON_RECORDER_OUT_DIR)

Copy link
Member

Choose a reason for hiding this comment

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

makes sense. a single variable is easier to maintain, but maybe this way it's more recorder/user-friendly indeed

src/trace.rb Outdated

trace_args = ARGV
ARGV = ARGV[1..-1]
trace_args = [program] + ARGV
Copy link
Member

Choose a reason for hiding this comment

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

does this work? it was important to override ARGS, if the user program uses it directly IIRC

Copy link
Member

Choose a reason for hiding this comment

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

ok, sorry: ARGV.shift does it now , however if we have more args like -o, maybe we need to move past them as well(but i assume order! does that)

Copy link
Member Author

Choose a reason for hiding this comment

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

The tests pass, so it should work :)

Copy link
Member

Choose a reason for hiding this comment

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

they don't seem to test for ARGV usage

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I'll add such test in a follow-up PR.

# or in the folder of `$CODETRACER_DB_TRACE_PATH` if such an env var is defined
ruby trace.rb [--out-dir DIR] <path to ruby file>
# produces several trace json files in DIR,
# or in `$CODETRACER_RUBY_RECORDER_OUT_DIR` if DIR is not provided.
Copy link
Member

Choose a reason for hiding this comment

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

this requires a reform/additional support in codetracer

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, make the necessary changes on CodeTracer's side once you bump the version of the ruby-recorder.

Copy link
Member

Choose a reason for hiding this comment

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

ok, we can do that. if we decide to directly produce codetracer archives, maybe this can be changed to _OUT_PATH but it's not clear yet

@zah zah force-pushed the codex/rename-env-variable-and-add-cli-options branch from 2fad6cd to 20335a7 Compare May 19, 2025 15:35
@zah zah merged commit 51d53c4 into main May 19, 2025
4 checks passed
@zah zah deleted the codex/rename-env-variable-and-add-cli-options branch May 19, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants