@@ -2,17 +2,14 @@ import 'dart:async';
22import 'dart:collection' ;
33
44import 'package:meta/meta.dart' ;
5- import 'metrics/metric.dart' ;
6- import 'metrics/metrics_aggregator.dart' ;
7- import 'metrics/metrics_api.dart' ;
8- import 'profiling.dart' ;
9- import 'propagation_context.dart' ;
10- import 'transport/data_category.dart' ;
115
126import '../sentry.dart' ;
137import 'client_reports/discard_reason.dart' ;
8+ import 'profiling.dart' ;
9+ import 'propagation_context.dart' ;
1410import 'sentry_tracer.dart' ;
1511import 'sentry_traces_sampler.dart' ;
12+ import 'transport/data_category.dart' ;
1613
1714/// Configures the scope through the callback.
1815typedef ScopeCallback = FutureOr <void > Function (Scope );
@@ -41,16 +38,6 @@ class Hub {
4138
4239 late final _WeakMap _throwableToSpan;
4340
44- late final MetricsApi _metricsApi;
45-
46- @internal
47- @Deprecated (
48- 'Metrics will be deprecated and removed in the next major release. Sentry will reject all metrics sent after October 7, 2024. Learn more: https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics' )
49- MetricsApi get metricsApi => _metricsApi;
50-
51- @internal
52- MetricsAggregator ? get metricsAggregator => _peek ().client.metricsAggregator;
53-
5441 factory Hub (SentryOptions options) {
5542 _validateOptions (options);
5643
@@ -62,7 +49,6 @@ class Hub {
6249 _stack.add (_StackItem (_getClient (_options), Scope (_options)));
6350 _isEnabled = true ;
6451 _throwableToSpan = _WeakMap (_options);
65- _metricsApi = MetricsApi (hub: this );
6652 }
6753
6854 static void _validateOptions (SentryOptions options) {
@@ -634,45 +620,6 @@ class Hub {
634620 return sentryId;
635621 }
636622
637- @internal
638- Future <SentryId > captureMetrics (
639- Map <int , Iterable <Metric >> metricsBuckets) async {
640- var sentryId = SentryId .empty ();
641-
642- if (! _isEnabled) {
643- _options.logger (
644- SentryLevel .warning,
645- "Instance is disabled and this 'captureMetrics' call is a no-op." ,
646- );
647- } else if (! _options.enableMetrics) {
648- _options.logger (
649- SentryLevel .info,
650- "Metrics are disabled and this 'captureMetrics' call is a no-op." ,
651- );
652- } else if (metricsBuckets.isEmpty) {
653- _options.logger (
654- SentryLevel .info,
655- "Metrics are empty and this 'captureMetrics' call is a no-op." ,
656- );
657- } else {
658- final item = _peek ();
659- try {
660- sentryId = await item.client.captureMetrics (metricsBuckets);
661- } catch (exception, stackTrace) {
662- _options.logger (
663- SentryLevel .error,
664- 'Error while capturing metrics.' ,
665- exception: exception,
666- stackTrace: stackTrace,
667- );
668- if (_options.automatedTestMode) {
669- rethrow ;
670- }
671- }
672- }
673- return sentryId;
674- }
675-
676623 @internal
677624 void setSpanContext (
678625 dynamic throwable,
0 commit comments