oracletrace icon indicating copy to clipboard operation
oracletrace copied to clipboard

[Feature]: Add examples/ directory with minimal scripts + docs references

Open KaykCaputo opened this issue 7 months ago • 0 comments

Summary

Add an examples/ directory with a few minimal, reproducible Python scripts to make onboarding and local testing easier for new contributors.

Problem

The README describes the workflow (trace, export JSON, compare), but there are no in-repo example scripts that contributors can run immediately. This increases friction for first-time users and makes it harder to reproduce issues or validate changes quickly.

Proposed Solution

Create an examples/ folder containing at least 3 small scripts demonstrating:

  1. CPU-bound hotspot (easy to see in top functions)
  2. Nested call graph (good for tree visualization)
  3. A simple regression demo (baseline vs slower path) to test compare flows

Also update README and/or docs to reference these examples with copy-paste commands.

Use Case

A new contributor clones the repo and wants to validate:

  • oracletrace examples/nested_calls.py
  • JSON export
  • compare flow …without having to write their own test script.

Example (optional)

bash: oracletrace examples/nested_calls.py oracletrace examples/regression_demo.py --json baseline.json oracletrace examples/regression_demo.py --json current.json --compare baseline.json

text: [OracleTrace] Trace complete. [OracleTrace] Comparison complete: 3 slower functions detected.

Alternatives Considered

  • Keeping examples only in the docs (harder to run locally and to use in tests).
  • Using external gists (not versioned with the project).

Additional Context

Suggested files:

  • examples/cpu_hotspot.py
  • examples/nested_calls.py
  • examples/regression_demo.py

Keep scripts deterministic and fast (<1s each) so they can also be reused in future pytest smoke tests.

Checklist

  • [ x ] I searched existing issues before opening this request
  • [ x ] I described the problem and why this feature is useful
  • [ x ] I provided enough detail for implementation discussion

KaykCaputo avatar Apr 17 '26 02:04 KaykCaputo