Skip to content

feat(core): implement v0.2.0 zero-cost telemetry with optimized scope handling#1

Merged
seanbrar merged 2 commits intodevfrom
feat/v0.2.0-core-implementation
Feb 5, 2026
Merged

feat(core): implement v0.2.0 zero-cost telemetry with optimized scope handling#1
seanbrar merged 2 commits intodevfrom
feat/v0.2.0-core-implementation

Conversation

@seanbrar
Copy link
Owner

@seanbrar seanbrar commented Feb 5, 2026

Summary

  • Implement full telemetry API with scope timing, metrics (count/gauge), and a @timed decorator supporting both sync and async functions
  • Add early validation for scope names and reporters with explicit error messages
  • Optimize performance by replacing @contextmanager with an explicit _Scope class and using an _identity function to avoid lambda allocation in no-op decorators

Notes

  • The _Scope class uses __slots__ for memory efficiency and avoids the overhead of generator-based context managers
  • Reporter lifecycle hooks (flush, shutdown) are optional and fail gracefully if not implemented
  • Strict scope name validation is gated behind NULLSCOPE_STRICT=1 to preserve backwards compatibility

Sean Brar added 2 commits February 4, 2026 21:32
Optimize scope timing by using an explicit context manager class instead
of @contextmanager decorator. This reduces overhead from generator-based
context managers and avoids lambda allocation in no-op decorators.
@seanbrar seanbrar merged commit f3e654d into dev Feb 5, 2026
5 checks passed
@seanbrar seanbrar deleted the feat/v0.2.0-core-implementation branch February 5, 2026 06:43
seanbrar added a commit that referenced this pull request Feb 5, 2026
## Summary
  
Adds test coverage, performance benchmarks, and documentation for the v0.2.0 ergonomics features (decorators, lifecycle hooks, async safety, strict mode). Core implementation was landed in #1.

## Notes

- Performance benchmarks were pulled forward from the v0.4.0 roadmap to v0.2.0—they were needed to validate the `_Scope` class optimization and establish baselines.
- `NULLSCOPE_STRICT` is documented only in the README env var table for now; design.md addition deferred unless users request clarification.
- `uv.lock` is now tracked for reproducible CI.
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