createHttpTrace method

  1. @override
Future<SentryHttpMetric> createHttpTrace({
  1. required String name,
  2. required String url,
  3. required MonitoringHttpMethod method,
})
override

Implementation

@override
Future<SentryHttpMetric> createHttpTrace({
  required String name,
  required String url,
  required MonitoringHttpMethod method,
}) async {
  if (!isReady) {
    logger.warning(this, '$providerName: Sentry is not initialized');
    throw Exception('$providerName: Sentry is not initialized');
  }

  logger.debug(this, 'Creating Http Metric:$name');

  SentryHttpMetric metric = SentryHttpMetric(
    name: name,
    url: url,
    method: method,
  );

  await metric.initialize(
    autoStart: true,
    canTrace: (settings?.mode == TraceMode.httpOnly ||
        settings?.mode == TraceMode.both),
  );

  return metric;
}