Skip to content

v0.0.2

Choose a tag to compare

@angvp angvp released this 28 Sep 02:46
· 425 commits to main since this release

Overview

v0.0.2 introduces comprehensive observability, graceful shutdown, rate limiting, and real-time WebSocket enhancements to the Tango framework.

Features

Observability & Logging

  • Structured HTTP Logging: Added request IDs and access/metrics middleware for comprehensive request tracking
  • Observability Package: New observability package with a Recorder for centralized metrics and structured logging
  • Realtime Instrumentation: Hub operations now instrumented with the shared Recorder for visibility into WebSocket connections

Application Lifecycle & Graceful Shutdown

ServeContext: New ServeContext for lifecycle-aware graceful shutdown
Lifecycle Management: Lifecycle registration and stop-phase budget sharing across all Lifecycle.Stop calls
Realtime Integration: Realtime chat Hub now properly integrated into graceful shutdown process
Documentation: Comprehensive docs on application lifecycle and graceful shutdown patterns

Rate Limiting

Token Bucket Implementation: New ratelimit package with token-bucket core algorithm
Flexible Key Functions: KeyFunc and RemoteIPKey for flexible rate limit key extraction
Middleware Integration: Rate limit middleware ready to use in any HTTP handler
Safety Guarantees: Handles impossible costs, nil CIDRs, and overflow-safe bucket cleanup with opportunistic cleanup

WebSocket Enhancements

Configurable CORS: WebSocket View now allows configuration of upgrade's origin check for better CORS control

Bug Fixes

  • Fixed handling of nil trusted CIDRs in RemoteIPKey
  • Fixed impossible cost rejection in ratelimit.Limiter.Take
  • Added opportunistic, overflow-safe bucket cleanup to Limiter
  • Fixed stop-phase budget sharing to ensure consistent lifecycle behavior

Documentation

  • Documented application lifecycle patterns and graceful shutdown process
  • Documented cost-limit rejection and bucket cleanup behavior
  • Unified version references to v0.0.1 in docs
  • Documented rate limiting and integrated examples in notes-starter

Refactoring

  • Delegated Serve logic to ServeContext for cleaner architecture

What's Next

The v0.0.2 release provides a solid foundation for production-grade applications with proper observability, graceful shutdown, and rate limiting. Future releases will expand on these capabilities.