Skip to content

v0.6.0

Choose a tag to compare

@brickfrog brickfrog released this 05 Apr 13:20
· 84 commits to main since this release

v0.6.0 - Ergonomics and Stdlib Modernization

Breaking Changes

  • tap() renamed to intercept(): the function runs the callback before the subscriber, matching middleware-style interception. For passive observation, use compose().
  • set_status() clears status_message on non-error status: setting a non-SpanError status without an explicit message no longer leaves an old error message attached to an OK status.

New Features

  • field() constructor with ToJson trait dispatch: a single generic function now accepts any ToJson value, 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(), and set_global_field() accept any ToJson value: the same conversion style now works across the API surface. Existing Json values 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, and UInt64::to_string(radix=16).
  • Idiomatic MoonBit patterns: simplified empty-string checks, negation, string interpolation, array copying, and redundant Show::to_string implementations.
  • Performance: emit() now returns early when no subscriber is set, avoiding unnecessary Event allocation.

Documentation

Added a design-decisions section to CLAUDE.md for intentional formatting and status behavior.