getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
746 stars 233 forks source link

metrics_aggregator_test is flaky #2302

Open vaind opened 4 days ago

vaind commented 4 days ago

Description

I see this fail from time to time

❌ test/metrics/metrics_aggregator_test.dart: emit in same time bucket same metric with different tags emit different metrics (failed)
  Expected: <2>
    Actual: <1>

  package:matcher                                  expect
  test/metrics/metrics_aggregator_test.dart 189:7  main.<fn>.<fn>
vaind commented 3 days ago

Also some more in https://github.com/getsentry/sentry-dart/actions/runs/10942003756/job/30377979535

❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit calls add (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit calls add (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit set (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit set (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit counter (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit counter (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit gauge (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit gauge (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit distribution (failed after test completion)
❌ test/metrics/metrics_aggregator_test.dart: span local aggregation emit distribution (failed after test completion)

a sample stack trace:

ClientException: XMLHttpRequest error., uri=https://sentry.example.com/api/1/envelope/
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/core_patch.dart 835:36   Object.StackTrace.current
  package:http/src/browser_client.dart 98:22                                BrowserClient.send.<fn>
  package:stack_trace                                                       StackZoneSpecification._run
  org-dartlang-sdk:///lib/async/zone.dart 1407:46                           StaticClosure._rootRunUnary
  org-dartlang-sdk:///lib/async/zone.dart 1307:34                           _CustomZone.runUnary
  org-dartlang-sdk:///lib/async/future_impl.dart 127:29                     _Future._propagateToListeners.handleValueCallback
  org-dartlang-sdk:///lib/async/future_impl.dart 875:13                     Object._Future._propagateToListeners
  org-dartlang-sdk:///lib/async/future_impl.dart 638:7                      _Future._complete
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            _AsyncCompleter.completeError
  package:http/src/browser_client.dart 96:7                                 BrowserClient.send.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1328:34                           _CustomZone.registerUnaryCallback
  org-dartlang-sdk:///lib/async/future_impl.dart 331:11                     _Future.then
  org-dartlang-sdk:///lib/async/future_impl.dart 318:13                     _Future.then
  package:http/src/browser_client.dart 93:33                                <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 332:23  _wrapJsFunctionForAsync.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/transport/http_transport.dart 47:37                    <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 332:23  _wrapJsFunctionForAsync.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/sentry_client.dart 596:22                              SentryClient._attachClientReportsAndSend.<fn>
  package:sentry/src/transport/task_queue.dart 23:22                        <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/transport/task_queue.dart 16:5                         TaskQueue.enqueue
  package:sentry/src/sentry_client.dart 595:12                              SentryClient._attachClientReportsAndSend
  package:sentry/src/sentry_client.dart 447:22                              <fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/sentry_client.dart 442:11                              SentryClient.captureMetrics
  package:sentry/src/hub.dart 615:31                                        <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/hub.dart 595:9                                         Hub.captureMetrics
  package:sentry/src/metrics/metrics_aggregator.dart 161:13                 <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 169:5                  <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:sentry/src/metrics/metrics_aggregator.dart 125:51                 MetricsAggregator._scheduleFlush.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1321:34                           _CustomZone.registerCallback
  org-dartlang-sdk:///lib/async/zone.dart 1248:22                           _CustomZone.bindCallbackGuarded
  org-dartlang-sdk:///lib/async/timer.dart 55:37                            Object.Timer.Timer
  package:sentry/src/metrics/metrics_aggregator.dart 125:9                  MetricsAggregator._scheduleFlush
  package:sentry/src/metrics/metrics_aggregator.dart 113:5                  MetricsAggregator.emit
  test/metrics/metrics_aggregator_test.dart 492:5                           <fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:test_api                                                          <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 332:23  _wrapJsFunctionForAsync.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  org-dartlang-sdk:///lib/async/zone.dart 1399:12                           StaticClosure._rootRun
  org-dartlang-sdk:///lib/async/zone.dart 1300:34                           _CustomZone.run
  org-dartlang-sdk:///lib/async/zone.dart 1804:10                           Object._runZoned
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  package:test_api                                                          <fn>
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 307:19  _wrapJsFunctionForAsync.closure.$protected
  org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart 332:23  _wrapJsFunctionForAsync.<fn>
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  org-dartlang-sdk:///lib/async/zone.dart 1399:12                           StaticClosure._rootRun
  org-dartlang-sdk:///lib/async/zone.dart 1300:34                           _CustomZone.run
  org-dartlang-sdk:///lib/async/zone.dart 1804:10                           Object._runZoned
  ===== asynchronous gap ===========================
  org-dartlang-sdk:///lib/async/zone.dart 1336:34                           _CustomZone.registerBinaryCallback
  org-dartlang-sdk:///lib/async/zone.dart 596:30                            Object._wrapJsFunctionForAsync
  org-dartlang-sdk:///lib/async/zone.dart 1399:12                           StaticClosure._rootRun
  org-dartlang-sdk:///lib/async/zone.dart 1300:34                           _CustomZone.run
  org-dartlang-sdk:///lib/async/zone.dart 1804:10                           Object._runZoned
buenaflor commented 3 days ago

@stefanosiano since we're deprecating metrics, should we remove the tests now?