v0.3.2
What's Changed
- fix: ensure otel attributes stay at absolute root level with nested groups
- fix: correct WithAttrs grouping behavior in otel handler
Bug Fixes
Otel Handler Grouping Issue:
- Fixed critical bug where attributes added via
WithAttrs()were leaking to root level instead of staying in their intended groups - Example:
logger.WithGroup("module").With("key", "value")now correctly producesmodule.key=valueinstead ofkey=value - Otel trace attributes (
otel.trace_id,otel.span_id,otel.service_name) continue to stay at root level as designed
Performance:
- Zero impact when no tracing active
- ~9% performance cost with active spans (acceptable for correctness)
- Same memory allocation patterns - no memory leaks
Technical Details
The fix restructures the otel handler's attribute tracking to separate:
- Root-level attributes: otel trace data (always at root)
- Grouped attributes: user data via
WithAttrs()(respects group hierarchy)
This ensures the original design goal of keeping otel data at root level while fixing the bug where user attributes escaped their intended groups.
Upgrade Effort: MICRO
This is a bug fix release - existing code will work better without any changes required.
Full Changelog: v0.3.1...v0.3.2