Skip to content

Add a runnable example, its real output and a request-flow diagram to the README - #50

Open
dmccoystephenson wants to merge 1 commit into
mainfrom
docs/readme-visuals
Open

dmccoystephenson wants to merge 1 commit into
mainfrom
docs/readme-visuals

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

The README had no visuals. This adds real ones:

  • examples/demo.py, a self-contained example that starts a stand-in trace server on a free loopback port (standard library ThreadingHTTPServer, answering 201 like a trace server), points a TraceClient at it with a demo key, reports three events, close()s, and prints what the server received. It then builds the client with DO_NOT_TRACK=1, enabled="false" and an empty key and prints enabled / disabled_reason for each. Nothing leaves the machine.
  • docs/screenshots/demo-output.png (83 KB): the actual output of python examples/demo.py, rendered as a terminal and screenshotted in headless Chromium. Added as a hero image after the intro example and in a new Screenshots section with a caption.
  • "How a report travels": a Mermaid sequence diagram (rendered by GitHub) of program → TraceClient → bounded queue → sender thread → POST /api/metrics, written from trace_client.py: opt-out order in the constructor, tag merging, put_nowait, the non-201/redirect/timeout path logged at DEBUG, and close() draining behind a stop signal. It is a diagram, not a screenshot.
  • Regenerating: darkroom shoot docs/screenshots/media.json runs the example (render_terminal.py) and screenshots the output. .darkroom/ was added to .gitignore; the generated HTML goes to the already-ignored build/.

The image contains only demo values (demo-game, demo-key, a loopback server); the random install ID is cut to its first eight characters by the example.

No library code was changed.

Tests

python -m unittest was run locally on Python 3.8.10: 84 pass, 2 fail. Both failures are pre-existing on main and unrelated to this change: chore: release 0.5.1 (#48) set __version__ = "0.5.1" but left the file header at 0.5.0 and test_user_agent_names_the_client_version expecting 0.5.0, so the Build workflow on main is already red (run 44866128194). This PR is expected to show the same two failures until that is fixed separately. examples/demo.py was run six times in a row without a failure, and the Mermaid block was rendered with Mermaid 10.9.1 to check it parses.

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

… the README

A self-contained example (examples/demo.py) was added that runs the client
against a stand-in trace server on a loopback port and prints what arrives,
then shows each opt-out. Its real output was rendered to
docs/screenshots/demo-output.png with a darkroom shot list
(docs/screenshots/media.json), and the image was added to the README as a
hero image and in a new Screenshots section. A Mermaid sequence diagram of
the report path (constructor opt-outs, queue, sender thread, POST
/api/metrics, close() draining) was written from trace_client.py.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant