Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove metrics API #2571

Merged
merged 13 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 0 additions & 93 deletions .github/workflows/metrics.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Removals
buenaflor marked this conversation as resolved.
Show resolved Hide resolved

- Remove Metrics API ([#2571](https://github.com/getsentry/sentry-dart/pull/2571))
buenaflor marked this conversation as resolved.
Show resolved Hide resolved

### Features

- Add `beforeCapture` for View Hierarchy ([#2523](https://github.com/getsentry/sentry-dart/pull/2523))
Expand Down
59 changes: 3 additions & 56 deletions dart/lib/src/hub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ import 'dart:async';
import 'dart:collection';

import 'package:meta/meta.dart';
import 'metrics/metric.dart';
import 'metrics/metrics_aggregator.dart';
import 'metrics/metrics_api.dart';
import 'profiling.dart';
import 'propagation_context.dart';
import 'transport/data_category.dart';

import '../sentry.dart';
import 'client_reports/discard_reason.dart';
import 'profiling.dart';
import 'propagation_context.dart';
import 'sentry_tracer.dart';
import 'sentry_traces_sampler.dart';
import 'transport/data_category.dart';

/// Configures the scope through the callback.
typedef ScopeCallback = FutureOr<void> Function(Scope);
Expand Down Expand Up @@ -41,16 +38,6 @@ class Hub {

late final _WeakMap _throwableToSpan;

late final MetricsApi _metricsApi;

@internal
@Deprecated(
'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')
MetricsApi get metricsApi => _metricsApi;

@internal
MetricsAggregator? get metricsAggregator => _peek().client.metricsAggregator;

factory Hub(SentryOptions options) {
_validateOptions(options);

Expand All @@ -62,7 +49,6 @@ class Hub {
_stack.add(_StackItem(_getClient(_options), Scope(_options)));
_isEnabled = true;
_throwableToSpan = _WeakMap(_options);
_metricsApi = MetricsApi(hub: this);
}

static void _validateOptions(SentryOptions options) {
Expand Down Expand Up @@ -634,45 +620,6 @@ class Hub {
return sentryId;
}

@internal
Future<SentryId> captureMetrics(
Map<int, Iterable<Metric>> metricsBuckets) async {
var sentryId = SentryId.empty();

if (!_isEnabled) {
_options.logger(
SentryLevel.warning,
"Instance is disabled and this 'captureMetrics' call is a no-op.",
);
} else if (!_options.enableMetrics) {
_options.logger(
SentryLevel.info,
"Metrics are disabled and this 'captureMetrics' call is a no-op.",
);
} else if (metricsBuckets.isEmpty) {
_options.logger(
SentryLevel.info,
"Metrics are empty and this 'captureMetrics' call is a no-op.",
);
} else {
final item = _peek();
try {
sentryId = await item.client.captureMetrics(metricsBuckets);
} catch (exception, stackTrace) {
_options.logger(
SentryLevel.error,
'Error while capturing metrics.',
exception: exception,
stackTrace: stackTrace,
);
if (_options.automatedTestMode) {
rethrow;
}
}
}
return sentryId;
}

@internal
void setSpanContext(
dynamic throwable,
Expand Down
16 changes: 0 additions & 16 deletions dart/lib/src/hub_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import 'package:meta/meta.dart';

import 'hint.dart';
import 'hub.dart';
import 'metrics/metric.dart';
import 'metrics/metrics_aggregator.dart';
import 'metrics/metrics_api.dart';
import 'profiling.dart';
import 'protocol.dart';
import 'protocol/sentry_feedback.dart';
Expand All @@ -27,11 +24,6 @@ class HubAdapter implements Hub {
@internal
SentryOptions get options => Sentry.currentHub.options;

@override
@internal
// ignore: deprecated_member_use_from_same_package
MetricsApi get metricsApi => Sentry.currentHub.metricsApi;

factory HubAdapter() {
return _instance;
}
Expand Down Expand Up @@ -193,14 +185,6 @@ class HubAdapter implements Hub {
@override
Scope get scope => Sentry.currentHub.scope;

@override
Future<SentryId> captureMetrics(Map<int, Iterable<Metric>> metricsBuckets) =>
Sentry.currentHub.captureMetrics(metricsBuckets);

@override
MetricsAggregator? get metricsAggregator =>
Sentry.currentHub.metricsAggregator;

@override
Future<SentryId> captureFeedback(
SentryFeedback feedback, {
Expand Down
37 changes: 0 additions & 37 deletions dart/lib/src/metrics/local_metrics_aggregator.dart

This file was deleted.

Loading
Loading