1.5.0
Release Notes
Version 1.5.0 - Async Batch Sending
Release Date: 2026-01-22
Overview
This release switches batch sending from synchronous ApiCall to asynchronous AsyncApiCall, providing non-blocking trace delivery. This change improves application performance by preventing batch sends from blocking request processing, especially under high load.
Performance Improvements
Asynchronous Batch Sending
- Non-Blocking Operations - Batch sends now execute asynchronously using
AsyncApiCallwith fire-and-forget mode - Improved Request Latency - Application requests are no longer blocked waiting for batch HTTP requests to complete
- Better Scalability - Handles high trace volumes without impacting application response times
- Background Execution - Batch sends happen in the background without blocking the main request flow
Before:
// Synchronous sending - blocks until HTTP request completes
$apiCall = new \Gemvc\Http\ApiCall();
$response = $apiCall->postRaw($endpoint, $jsonPayload, 'application/json');After:
// Asynchronous sending - fire-and-forget, non-blocking
$async = new \Gemvc\Http\AsyncApiCall();
$async->setTimeouts(5, 10);
$async->addPost('apm_batch_send', $endpoint, $payload, $headers);
$async->fireAndForget();Changes
AbstractApm
- Replaced
sendBatchViaApiCall()withsendBatchAsync()- Now usesAsyncApiCallinstead of synchronousApiCall - Fire-and-Forget Pattern - Batch sends execute in background without waiting for response
- Improved Error Handling - Async failures are logged but don't block the application
- Maintained Timeouts - Keeps 5s connect and 10s total timeouts for APM operations
- Enhanced Logging - Added tracking of total traces sent per provider for monitoring
Swoole Environment Support
- Swoole Detection - Automatically detects Swoole/OpenSwoole environments
- Batch Size Limiting - Limits batch size to 50 traces in Swoole to prevent unbounded memory growth
- FIFO Trace Dropping - Drops oldest traces when batch limit is reached in Swoole
- Skip Batch Checks - Skips time-based batch checks in Swoole to avoid overhead
- Explicit Flush - Relies on explicit
flush()calls in Swoole instead of time-based sending
Migration Guide
No breaking changes - This release is fully backward compatible.
For Users:
- No action required - the change is automatic
- Batch sends now happen asynchronously without blocking requests
- Application performance should improve, especially under high load
- All existing configurations continue to work as before
For Provider Developers:
- No changes required to provider implementations
- The
buildBatchPayload(),getBatchEndpoint(), andgetBatchHeaders()methods work exactly as before - Provider packages continue to work without modification
Technical Details
AsyncApiCall Integration
The new sendBatchAsync() method:
- Uses
AsyncApiCallfor non-blocking HTTP requests - Implements fire-and-forget pattern for background execution
- Maintains same timeout configuration (5s connect, 10s total)
- Automatically handles JSON encoding via
addPost()method - Logs successful batch initiation in dev environment
Swoole Optimizations
For Swoole/OpenSwoole environments:
- Batch size limited to 50 traces to prevent memory issues
- Time-based batch checks are skipped entirely
- Traces accumulate until explicit
flush()is called - Oldest traces are dropped when batch limit is reached (FIFO)
Configuration
No configuration changes required. All existing settings continue to work:
# Batch send interval (still configurable)
APM_SEND_INTERVAL=5
# All other APM settings unchanged
APM_NAME=TraceKit
APM_ENABLED=true
APM_SAMPLE_RATE=1.0Changelog
Changed:
- Batch sending switched from synchronous
ApiCallto asynchronousAsyncApiCall sendBatchViaApiCall()replaced withsendBatchAsync()method- Added Swoole environment detection and optimizations
- Added batch size limiting for Swoole environments (50 traces max)
- Added total traces sent tracking per provider
Performance:
- Non-blocking batch sends improve application response times
- Reduced request latency under high trace volumes
- Better scalability for high-throughput applications
- Background execution prevents blocking operations
Logging:
- Enhanced logging with total traces sent per provider
- Dev environment logging for batch initiation and status
- Swoole batch size limit warnings in dev environment
