SentryClient constructor
SentryClient(
- SentryOptions options, {
- LogCapturePipeline? logCapturePipeline,
- MetricCapturePipeline? metricCapturePipeline,
- SpanCapturePipeline? spanCapturePipeline,
Instantiates a client using SentryOptions
Implementation
factory SentryClient(
SentryOptions options, {
LogCapturePipeline? logCapturePipeline,
MetricCapturePipeline? metricCapturePipeline,
SpanCapturePipeline? spanCapturePipeline,
}) {
if (options.sendClientReports) {
options.recorder = ClientReportRecorder(options.clock);
}
RateLimiter? rateLimiter;
if (options.transport is NoOpTransport) {
rateLimiter = RateLimiter(options);
options.transport = HttpTransport(options, rateLimiter);
}
// rateLimiter is null if FileSystemTransport is active since Native SDKs take care of rate limiting
options.transport = ClientReportTransport(
rateLimiter,
options,
options.transport,
);
// TODO: Use spotlight integration directly through JS SDK, then we can remove isWeb check
final enableFlutterSpotlight = (options.spotlight.enabled &&
(options.platform.isWeb ||
options.platform.isLinux ||
options.platform.isWindows));
// Spotlight in the Flutter layer is only enabled for Web, Linux and Windows
// Other platforms use spotlight through their native SDKs
if (enableFlutterSpotlight) {
options.transport = SpotlightHttpTransport(options, options.transport);
}
return SentryClient._(
options,
logCapturePipeline ?? LogCapturePipeline(options),
metricCapturePipeline ?? MetricCapturePipeline(options),
spanCapturePipeline ?? SpanCapturePipeline(options),
);
}