perf: StepCollector context manager for pipeline runner #207
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement
src/perf/collector.py— the core instrumentation wrapper.API
Tasks
StepCollectorcontext manager that creates child span, records timingrecord()method captures rows.in, rows.out, columns, cache.hitctx.load()andctx.save()with grandchild spans (load duration, bytes, rows)OTel Resourceattributes: service.name, pipeline name, git SHA, context (local/lake/databricks)src/perf/_resource.py— build OTel Resource from stack.toml + git rev-parsesrc/perf/_system.py— psutil snapshots (cpu_percent, rss, disk_io_counters)Starting work on StepCollector + _system.py + _resource.py enhancements.
Plan:
src/perf/_system.py— psutil snapshots (RSS, CPU%, disk I/O)src/perf/collector.py— StepCollector context manager with span + metricsComplete.
Created:
src/perf/_system.py—take_snapshot()(RSS, CPU%, disk I/O via psutil),delta()for before/after comparisonsrc/perf/collector.py—PipelineCollectorcontext manager with:step()— child span per step with timing, row counts, cache hit, system deltasload()/save()— grandchild spans for data I/OStepContext.record(rows, columns, cache_hit)APILoadContext.record(rows)APITests: 10 in
test_collector.py✅ 10/10 passed, lint clean.