Repository navigation
v0.6.0
v0.6.0 - Ergonomics and Stdlib Modernization
Breaking Changes
tap()renamed tointercept(): the function runs the callback before the subscriber, matching middleware-style interception. For passive observation, usecompose().set_status()clearsstatus_messageon non-error status: setting a non-SpanErrorstatus without an explicit message no longer leaves an old error message attached to anOKstatus.
New Features
field()constructor withToJsontrait dispatch: a single generic function now accepts anyToJsonvalue, eliminating.to_json()ceremony on every field value.
// Before
fields=@moontrace.fields([("port", (8080).to_json()), ("host", "localhost".to_json())])
// After
fields=[@moontrace.field("port", 8080), @moontrace.field("host", "localhost")]Span::record(),Span::with_field(), andset_global_field()accept anyToJsonvalue: the same conversion style now works across the API surface. ExistingJsonvalues still work unchanged.
Improvements
- Stdlib modernization: replaced hand-rolled helpers with MoonBit stdlib equivalents, including
String::pad_start,String::pad_end,String::split_once,String::rev_split_once, andUInt64::to_string(radix=16). - Idiomatic MoonBit patterns: simplified empty-string checks, negation, string interpolation, array copying, and redundant
Show::to_stringimplementations. - Performance:
emit()now returns early when no subscriber is set, avoiding unnecessaryEventallocation.
Documentation
Added a design-decisions section to CLAUDE.md for intentional formatting and status behavior.