Add stats logging interface for dashboards and LLM usage - #66
Merged
Conversation
Emit machine-readable events after each review (review.completed) and auto-approval decision (approval.decided) so admins can build dashboards (Datadog, Logstash, …) tracking review volume, finding rates, token usage, and auto-approve rate. JSON Lines and command sinks ship built-in behind a pluggable sink registry; a real commit_sha now enriches every event and the review report. Stats are off by default and fail-open so a stats outage never fails a review. Issue #64.
Outdated Thingie summary✅ No issues found across 23 file(s). |
pdw207
previously approved these changes
Aug 7, 2026
pdw207
left a comment
Contributor
There was a problem hiding this comment.
Yes!!! Looks good. OK to sequence post approve revert and human override approved later. Only wish I got to this first! Not that it would be better.
Signed-off-by: Kevin Lawver <38448+kplawver@users.noreply.github.com>
|
✅ No issues found across 23 file(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change do?
GitHub Issue: #64
jsonl) and command-pipe (command) sinks behind a sink registry anyone can extend viaThingie::Stats.register_sink; events carry stable join keys (repo, PR number, commit SHA) so downstream pipelines can correlate post-merge KRI signals (revert rate, human override).review.completedevent.What is risky about this change?
Low risk. Stats are off by default and require an explicit
[stats]section + at least one[[stats.sinks]]entry to emit anything. All sink dispatch is fail-open (warn + skip the sink), mirroring the Approver's philosophy — a stats outage never fails a review. Thecommit_shaenrichment incode-review-report.jsonwas always a schema field (round-trip safe viaReport.from_hash); it's now populated instead of null.Approver#runnow returns itsDecision(ornilon the error path) — all existing callers ignore the return value, so no behavior change.How to test this change?
bundle exec rake— 202 examples, 0 failures, including theyard_coverage_spec(all new classes/methods documented) and end-to-end cli_spec contexts provingreview→review.completedJSON line on disk andgithub-comment→approval.decidedline with block reasons. A live smoke run against a scratch repo emitted a validreview.completedevent to both a stdout jsonl sink and acommandsink viatee, with a realcommit_shamatching the saved report.Other Steps
None.