feat: dev-telemetry dogfooding loop (Task 22)#8
Conversation
CcxtOcx.DevTelemetry attaches a single handler to every [:ccxt_ocx, ...] event family, pretty-prints emissions to a configurable IO device, and keeps running counts + last measurements/metadata in an Agent. Surface: watch/1 (opts: :print, :filter, :io_device — idempotent, re-attach resets state), summary/0 (initial all-zeros state when Agent absent), reset/0 (no-op when Agent absent), detach/0 (idempotent). Auto-attached in dev via .iex.exs (guarded on Mix.env() == :dev AND Code.ensure_loaded?). docs/tidewave_examples.md gets a "Dev Telemetry Loop" section showing watch → drive → summary → reset → detach. Also lands the schema_version 1→2 migration in roadmap/tasks.toml that was pending on the host (adds [milestones.*] tables, includes v0_1/v1_0 release lines). Roadmap: Task 22 done (Phase 6 dx, depends_on Task 14, [D:2/B:5/U:8 → Eff:3.25 🎯]).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR adds CcxtOcx.DevTelemetry, an Agent-backed dev-only telemetry watcher exposing watch/1, detach/0, summary/0, and reset/0; includes comprehensive tests, an IEx auto-attach script, user docs, roadmap/task updates, and adds nimble_options to Mix deps. ChangesDevTelemetry Dogfooding Feature
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant IEx as .iex.exs (auto-attach)
participant Watch as CcxtOcx.DevTelemetry.watch/1
participant Telemetry as :telemetry
participant Handler as handle_event/4
participant Agent as DevTelemetry Agent
Dev->>IEx: start iex -S mix (dev)
IEx->>Watch: auto-call watch/0
Watch->>Agent: ensure_agent / reset
Watch->>Telemetry: attach handler
Telemetry->>Handler: emit events (runtime/rest/ws)
Handler->>Agent: increment counters / store last measurements
Handler->>Dev: print output when enabled
Dev->>Watch: summary()/reset()/detach()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds a maintainer-focused “dev telemetry loop” to make it easy to attach to all [:ccxt_ocx, ...] telemetry events during local dogfooding, plus accompanying docs/tests and roadmap metadata updates.
Changes:
- Introduces
CcxtOcx.DevTelemetry(Agent-backed counters + optional pretty-printing) withwatch/1,summary/0,reset/0, anddetach/0. - Adds an
.iex.exsdev auto-attach hook and Tidewave docs demonstrating the watch → drive → summary workflow. - Updates roadmap schema/data to v2 and adds milestone metadata + Task 22 completion.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/ccxt_ocx/dev_telemetry.ex |
New dev-only telemetry handler module with printing and in-memory counters. |
test/ccxt_ocx/dev_telemetry_test.exs |
New ExUnit coverage for attach/detach/idempotency/filtering/output routing/state behavior. |
.iex.exs |
Auto-attaches dev telemetry handler when running IEx in dev. |
docs/tidewave_examples.md |
Adds “Dev Telemetry Loop” documentation and usage examples. |
roadmap/tasks.toml |
Bumps schema to v2; adds milestones and marks Task 22 done (plus various task metadata additions). |
roadmap/data.json |
Mirrors roadmap schema bump and milestone/task metadata in JSON form. |
ROADMAP.md |
Updates rendered roadmap tables to include milestone tags and Task 22. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # release (where CcxtOcx.DevTelemetry might be filtered out) doesn't blow | ||
| # up the shell. | ||
|
|
||
| if Mix.env() == :dev and Code.ensure_loaded?(CcxtOcx.DevTelemetry) do |
| [[task]] | ||
| id = 22 | ||
| phase = 6 | ||
| bundle = "dx" | ||
| status = "done" | ||
| title = "Dev telemetry dogfooding loop (CcxtOcx.DevTelemetry)" |
| "id": 22, | ||
| "phase": 6, | ||
| "bundle": "dx", | ||
| "status": "done", | ||
| "title": "Dev telemetry dogfooding loop (CcxtOcx.DevTelemetry)", | ||
| "scores": { |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/ccxt_ocx/dev_telemetry.ex`:
- Around line 77-97: Add NimbleOptions validation for watch/1: define a
module-level NimbleOptions schema (e.g., opts schema with :print boolean,
:io_device atom, :filter list of atoms) and call NimbleOptions.validate!/2 at
the start of watch/1 to replace the current Keyword.get/3 calls; then use the
validated options map to derive print?, io_device and filter (falling back to
Map.keys(`@events`) if filter not provided) before calling ensure_agent(),
detach(), Agent.update, and :telemetry.attach_many with `@handler_id` and events
resolved via Map.fetch!(`@events`, &1).
In `@roadmap/data.json`:
- Around line 941-942: The task entry has a numeric id (id: 22) while all other
task[].id values are strings, causing inconsistent typing; update the id field
for that task to a string (e.g., "22") so task[].id remains consistently
string-typed and continues to match string values in depends_on and other joins;
verify the same task object (id and phase) is the one to change (id -> "22",
phase stays 6).
In `@roadmap/tasks.toml`:
- Line 772: The task entry uses a numeric id value (id = 22) which mismatches
the rest of the TOML where task IDs are strings; update the id field for this
task to a string (e.g., id = "22") so it matches the existing schema and avoids
type-mismatch issues during rendering/export and dependency resolution.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 08b1bb67-ad10-45a9-96f3-7e9f690fee09
📒 Files selected for processing (7)
.iex.exsROADMAP.mddocs/tidewave_examples.mdlib/ccxt_ocx/dev_telemetry.exroadmap/data.jsonroadmap/tasks.tomltest/ccxt_ocx/dev_telemetry_test.exs
Guard the IEx auto-attach path outside active Mix shells, validate DevTelemetry watch options before side effects, normalize Task 22 roadmap IDs, and resolve the development merge conflict.
Summary
CcxtOcx.DevTelemetry— maintainer-side dogfooding companion toCcxtOcx.Telemetry. Onewatch/1call attaches to every[:ccxt_ocx, ...]event family, pretty-prints emissions to a configurable IO device, and keeps running counts + last measurements/metadata in anAgent..iex.exsauto-attaches in dev (guarded onMix.env() == :devANDCode.ensure_loaded?) with a banner pointing tosummary/0.docs/tidewave_examples.mdgets a "Dev Telemetry Loop" section showingwatch → drive → summary → reset → detach.roadmap/tasks.tomlv1 → v2 (pending host migration) + adds[milestones.v0_1]/[milestones.v1_0]release lines.PR 2 of 2 for the PromEx + dogfooding bundle. PR 1 (Task 21 —
CcxtOcx.PromEx.Plugin) landed in #7. Both use the same[:ccxt_ocx, ...]event contract defined inlib/ccxt_ocx/telemetry.exso adding either downstream requires zero glue.Surface
watch/1is idempotent: re-call detaches the previous handler, clears the Agent state, and re-attaches with the new options — only one handler is attached at any time.Test plan
mix format --check-formattedcleanmix compile --warnings-as-errorsclean (2.93s)mix test.json --quiet— 170/170 offline pass (15:integration/:networkexcluded — not verified this run);test/ccxt_ocx/dev_telemetry_test.exscovers 14 scenarios: attach idempotency, filter, io_device routing, print-false silences-but-counts, per-event routing for every[:ccxt_ocx, ...]family, last-wins overwriting, reset, detach-then-emit, no-op-when-Agent-absent forsummary/0andreset/0mix credo --strict --format json— 0 issues on touched files (4 pre-existingTODO(Task N):markers onruntime.ex/runtime_pool.ex/runtime_test.exs— exit 2 carve-out for tracked debt per~/.claude/includes/development-philosophy.md)mix dialyzer.json --quiet— 0 warningsmix doctor— 100% doc / moduledoc / spec coveragemix reach.check --smells— 0 smells on touched files (2 pre-existing findings onerror.ex/verify_bundle.ex— out of scope):runtime, :memoryemission viaCcxtOcx.Telemetry.execute/3, asserted documentedsummary/0shape (counts + last_measurements + last_metadata) and pretty-print line format ([memory] malloc=12.3M used=8.1M objs=14523 server=#PID<...> phase=manual)Closes Task 22 (rmap-tracked,
[D:2/B:5/U:8 → Eff:3.25 🎯]).Summary by CodeRabbit
New Features
Documentation
Tests
Chores