Skip to content

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 26 Jan 09:08
· 3 commits to main since this release

Release v0.3.0

This release focuses on observability improvements, deterministic simulation support, and bug fixes.

Features

Seed Package:

  • New seed registry for deterministic simulations
  • seed.Init(masterSeed) for repeatable value sequences
  • Auto-initialization with time-based seed when not explicitly set
  • All random sources now use the global seed registry

Observability:

  • Added Stats() methods to Clock, Source, and Value interfaces
  • Clock metrics: tick count, running state, interval
  • Source metrics: generation count, subscriber count
  • Value metrics: update count, current value, transform count
  • Enables integration with Prometheus/OTEL without side effects

Value Package:

  • Simplified value implementation
  • Improved lifecycle management

Bug Fixes

  • Fixed race condition in PeriodicClock during shutdown
  • Fixed validation issues in value benchmark tests
  • Added comprehensive race condition tests for Value

Installation

go get github.com/neox5/simv@v0.3.0

Usage Example - Deterministic Simulation

import "github.com/neox5/simv/seed"

// Repeatable simulations
seed.Init(12345)

clk := clock.NewPeriodicClock(100 * time.Millisecond)
src := source.NewRandomIntSource(clk, 1, 10)
val := value.New(src).
    AddTransform(transform.NewAccumulate[int]()).
    Start()

// Access metrics
stats := val.Stats()
fmt.Printf("Updates: %d, Current: %d\n",
    stats.UpdateCount,
    stats.CurrentValue)