flutter_metrics_sdk 1.3.0
flutter_metrics_sdk: ^1.3.0 copied to clipboard
A lightweight Flutter performance analytics SDK to capture real-user metrics such as render time, frame drops, user interactions, and crashes.
1.3.0 #
Correct attribution of API and crash events #
API and crash events previously reported the request path (or the literal
string global_error_handler) in the screen field. Every distinct endpoint
therefore appeared as its own "screen" in the dashboard, each with zeroed-out
render metrics that diluted the app's averages and inflated its screen count.
- Added
targettosendMetricandMetricRecord:screennow always names a real, user-visible screen, andtargetcarries the endpoint path or crash handler name. - Added
ScreenContext, a shared record of the currently visible screen.ScreenTrackerkeeps it current;ApiMetricsInterceptorandCrashTrackerread from it, so their events are attributed to the screen the user was actually on. Both accept an injected context for testing.
Requires a backend with the target column (migration 006).
Delivery reliability #
- A flush that fails for a transient reason (network error, timeout, 5xx,
- now returns its events to the buffer and retries on the next flush
instead of dropping them. Definitive
4xxrejections are still dropped, since retrying them would never succeed.
- now returns its events to the buffer and retries on the next flush
instead of dropping them. Definitive
flush()is now re-entrant-safe: the periodic timer and amaxBatchSizetrip can no longer both send the same events.- Added
maxBufferSize(default 1000) to bound memory while the device is offline; the oldest events are discarded once it is reached.
Other fixes #
CrashTracker.initializenow chains to any previously installedFlutterError.onError/PlatformDispatcher.onErrorhandler instead of silently replacing it.ApiMetricsInterceptorkeys in-flight requests by a token on the request itself rather than byRequestOptionsidentity, so retries and redirects no longer lose or misattribute a latency measurement.ScreenTrackernow updates attribution ondidReplaceanddidRemove, and sets the current screen on push immediately rather than a frame later.
1.2.0 #
- Batched delivery: events are now buffered and sent to
/metrics/batchon a periodic timer (default 5s) or oncemaxBatchSizeevents are queued (default 20), instead of one HTTP request per event. - Added
sampleRateto probabilistically drop high-frequencyapp_renderframe events while always keeping crash, API and screen events. - Added
MetricsClient.flush()andMetricsClient.dispose()for manual flushing and graceful shutdown; the client now flushes automatically when the app is paused or detached. - Re-enabled connect/receive timeouts (15s) so a slow backend can no longer hang a flush.
FrameTrackernow takes a configurableframeBudgetMs(default 16) for non-60Hz displays, and exposesFrameTracker.isDropped.- Fixed unbounded growth of
ApiMetricsInterceptor's in-flight request map. - Added unit tests covering batching, sampling, frame-drop detection, the API interceptor and crash reporting.
- Added an
example/app and dartdoc comments across the public API.
1.1.0 #
- Added automatic screen and route tracking via
NavigatorObserver - Added API performance tracking
- Enhanced frame drop and render time tracking
- Added
app_renderandapi_callmetrics
1.0.1 #
- Initial stable release of Flutter Metrics SDK
- Supports screen render time tracking
- Supports frame drop (UI jank) detection
- Supports crash signal reporting
- Secure API key-based metrics ingestion
- Compatible with Flutter Mobile and Web