Skip to content

feat: dev-telemetry dogfooding loop (Task 22)#8

Merged
e-fu merged 2 commits into
developmentfrom
task-22-dev-telemetry
May 17, 2026
Merged

feat: dev-telemetry dogfooding loop (Task 22)#8
e-fu merged 2 commits into
developmentfrom
task-22-dev-telemetry

Conversation

@e-fu
Copy link
Copy Markdown
Contributor

@e-fu e-fu commented May 17, 2026

Summary

  • New CcxtOcx.DevTelemetry — maintainer-side dogfooding companion to CcxtOcx.Telemetry. One watch/1 call attaches to every [:ccxt_ocx, ...] event family, pretty-prints emissions to a configurable IO device, and keeps running counts + last measurements/metadata in an Agent.
  • .iex.exs auto-attaches in dev (guarded on Mix.env() == :dev AND Code.ensure_loaded?) with a banner pointing to summary/0.
  • docs/tidewave_examples.md gets a "Dev Telemetry Loop" section showing watch → drive → summary → reset → detach.
  • Schema bump: roadmap/tasks.toml v1 → 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 in lib/ccxt_ocx/telemetry.ex so adding either downstream requires zero glue.

Surface

:ok = CcxtOcx.DevTelemetry.watch()                # opts: :print, :filter, :io_device
:ok = CcxtOcx.DevTelemetry.watch(print: false)    # silent counters
:ok = CcxtOcx.DevTelemetry.watch(filter: [:ws_tick, :rest_stop])
state = CcxtOcx.DevTelemetry.summary()            # initial all-zeros if never watched
:ok = CcxtOcx.DevTelemetry.reset()                # no-op if Agent absent
:ok = CcxtOcx.DevTelemetry.detach()               # idempotent

watch/1 is 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-formatted clean
  • mix compile --warnings-as-errors clean (2.93s)
  • mix test.json --quiet — 170/170 offline pass (15 :integration/:network excluded — not verified this run); test/ccxt_ocx/dev_telemetry_test.exs covers 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 for summary/0 and reset/0
  • mix credo --strict --format json — 0 issues on touched files (4 pre-existing TODO(Task N): markers on runtime.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 warnings
  • mix doctor — 100% doc / moduledoc / spec coverage
  • mix reach.check --smells — 0 smells on touched files (2 pre-existing findings on error.ex / verify_bundle.ex — out of scope)
  • End-to-end smoke: simulated :runtime, :memory emission via CcxtOcx.Telemetry.execute/3, asserted documented summary/0 shape (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

    • Developer telemetry: watch, summary, reset, and detach for viewing runtime metrics; auto-attaches in development IEx sessions.
  • Documentation

    • New doc section with examples and configuration for the dev telemetry loop.
    • Roadmap updated with explicit release-version milestones and a tracked Dev Telemetry task.
  • Tests

    • Comprehensive telemetry test suite plus additional edge-case/unit tests.
  • Chores

    • Added runtime options dependency for telemetry configuration.

Review Change Stack

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 🎯]).
Copilot AI review requested due to automatic review settings May 17, 2026 11:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e26a58ca-3974-403f-9635-ed2a55b5dde7

📥 Commits

Reviewing files that changed from the base of the PR and between 26609c1 and 6c23390.

📒 Files selected for processing (7)
  • .iex.exs
  • lib/ccxt_ocx/dev_telemetry.ex
  • mix.exs
  • roadmap/data.json
  • roadmap/tasks.toml
  • test/ccxt_ocx/bundle_surface_test.exs
  • test/ccxt_ocx/dev_telemetry_test.exs
✅ Files skipped from review due to trivial changes (2)
  • mix.exs
  • roadmap/data.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • .iex.exs
  • lib/ccxt_ocx/dev_telemetry.ex

📝 Walkthrough

Walkthrough

This 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.

Changes

DevTelemetry Dogfooding Feature

Layer / File(s) Summary
Core DevTelemetry module and event handling
lib/ccxt_ocx/dev_telemetry.ex
Exposes watch/1 to attach a telemetry handler with configurable :filter, :print, and :io_device; uses a named Agent to accumulate per-event counts, last measurements, and metadata; provides detach/0, summary/0, and reset/0; and implements event-to-key mapping plus formatting helpers.
Comprehensive test coverage
test/ccxt_ocx/dev_telemetry_test.exs
ExUnit suite (async: false) validating watch idempotency and reset behavior, filter validation, pretty-printing and silence, event routing into runtime/REST/WS buckets, accumulation/last-wins semantics, reset/summary/detach behaviors, and agent lifecycle cleanup (including an .iex.exs smoke test).
Integration, user documentation, roadmap and task updates, dependency
.iex.exs, docs/tidewave_examples.md, ROADMAP.md, roadmap/data.json, roadmap/tasks.toml, mix.exs, test/ccxt_ocx/bundle_surface_test.exs
Adds a dev-only .iex.exs auto-attach script that starts DevTelemetry in Mix dev shells; documents a "Dev Telemetry Loop" with usage examples and options; records Task 22 in roadmap files with acceptance criteria and implemented notes; adds {:nimble_options, "~> 1.1"} to deps; and adds/supporting bundle-surface test helpers.

Sequence Diagram

sequenceDiagram
  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()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ZenHive/ccxt_ocx#6: The new DevTelemetry watcher attaches to the canonical [:ccxt_ocx, :runtime, :memory] and related telemetry families introduced by earlier telemetry work.

Poem

🐰 I scurry through metrics, keen and spry,
Agents store the last breath of a try,
Watch, reset, detach — a maintainer's song,
I print the small lines to keep you strong,
Hooray for dev loops, I hop along!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: dev-telemetry dogfooding loop (Task 22)' clearly and concisely describes the main change: introducing the DevTelemetry feature. It accurately summarizes the primary contribution across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task-22-dev-telemetry

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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) with watch/1, summary/0, reset/0, and detach/0.
  • Adds an .iex.exs dev 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.

Comment thread .iex.exs Outdated
# 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
Comment thread roadmap/tasks.toml
Comment on lines +771 to +776
[[task]]
id = 22
phase = 6
bundle = "dx"
status = "done"
title = "Dev telemetry dogfooding loop (CcxtOcx.DevTelemetry)"
Comment thread roadmap/data.json Outdated
Comment on lines +941 to +946
"id": 22,
"phase": 6,
"bundle": "dx",
"status": "done",
"title": "Dev telemetry dogfooding loop (CcxtOcx.DevTelemetry)",
"scores": {
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between e41fde3 and 26609c1.

📒 Files selected for processing (7)
  • .iex.exs
  • ROADMAP.md
  • docs/tidewave_examples.md
  • lib/ccxt_ocx/dev_telemetry.ex
  • roadmap/data.json
  • roadmap/tasks.toml
  • test/ccxt_ocx/dev_telemetry_test.exs

Comment thread lib/ccxt_ocx/dev_telemetry.ex
Comment thread roadmap/data.json Outdated
Comment thread roadmap/tasks.toml Outdated
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.
@e-fu e-fu merged commit 8510bde into development May 17, 2026
2 checks passed
@e-fu e-fu deleted the task-22-dev-telemetry branch May 17, 2026 12:23
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.

2 participants