Skip to content
Merged

test #1219

Show file tree
Hide file tree
Changes from all 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
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

<!-- prettier-ignore-start -->
> [!IMPORTANT]
> If you are upgrading to the `3.x` versions of the SDK from `2.x` or lower, make sure you follow our
> If you are upgrading to the `4.x` versions of the SDK from `3.x` or lower, make sure you follow our
> [migration guide](https://docs.sentry.io/platforms/javascript/guides/capacitor/migration/) first.
<!-- prettier-ignore-end -->

## Unreleased

#### Sentry Capacitor V4

Version 4 removes Session Replay and Profiling support. No additional breaking changes
are expected. If these features are enabled through other means, Sentry will not provide support for them.
All other SDK features, including error monitoring and performance monitoring, remain fully supported and
unchanged.

### Break Changes

- Remove Session Replay ([#1214](https://github.com/getsentry/sentry-capacitor/pull/1214))
- Remove Profiling support ([#1217](https://github.com/getsentry/sentry-capacitor/pull/1217))

### Fixes

- (Android): AGP 9.0 no longer supports `proguard-android.txt` ([#1196](https://github.com/getsentry/sentry-capacitor/pull/1196))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,6 @@ public void initNativeSdk(final PluginCall call) {
}
}

// In case some user enable Android Replay by accident,
// it will not work with JavaScript replay, so we enforce this to disable Android replay.
// If you are interested on being able to use native replay, please open a Github issue
// on the following repo: https://github.com/getsentry/sentry-capacitor.
var controller = options.getSessionReplay();
controller.setSessionSampleRate(null);
controller.setOnErrorSampleRate(null);

options.getLogs().setEnabled(Boolean.TRUE.equals(capOptions.getBoolean("enableLogs", false)));

logger.log(SentryLevel.INFO, String.format("Native Integrations '%s'", options.getIntegrations()));
Expand Down
23 changes: 6 additions & 17 deletions example/ionic-angular-v7/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { environment } from '../environments/environment';
// ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io
Sentry.init(
{
dsn:
'https://4079af8b316240ea9453eb0a23b715cc@o447951.ingest.sentry.io/5522756',
dsn: 'https://4079af8b316240ea9453eb0a23b715cc@o447951.ingest.sentry.io/5522756',
// An array of strings or regexps that'll be used to ignore specific errors based on their type/message
ignoreErrors: [/MiddleEarth_\d\d/, 'RangeError'],
// To see what the Sentry SDK is doing; Helps when setting things up
Expand All @@ -25,22 +24,18 @@ Sentry.init(
// Use the tracing integration to see traces and add performance monitoring
_experiments: {
enableMetrics: true,
beforeSendMetric: (metric) => {
beforeSendMetric: metric => {
return metric;
},
},
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: true,
}),
Sentry.spotlightIntegration({
sidecarUrl: environment.spotlightSidecarUrl,
sidecarUrl: environment.spotlightSidecarUrl,
}),
],
enableLogs: true,
beforeSendLog: (log) => {
beforeSendLog: log => {
return log;
},
// A release identifier
Expand All @@ -52,12 +47,6 @@ Sentry.init(
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
},
sentryAngularInit,
);
Expand All @@ -75,6 +64,6 @@ Sentry.init(
useValue: createErrorHandler(),
},
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
20 changes: 5 additions & 15 deletions example/ionic-angular-v8/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { environment } from '../environments/environment';
// ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io
Sentry.init(
{
dsn:
'https://4079af8b316240ea9453eb0a23b715cc@o447951.ingest.sentry.io/5522756',
dsn: 'https://4079af8b316240ea9453eb0a23b715cc@o447951.ingest.sentry.io/5522756',
// An array of strings or regexps that'll be used to ignore specific errors based on their type/message
ignoreErrors: [/MiddleEarth_\d\d/, 'RangeError'],
// To see what the Sentry SDK is doing; Helps when setting things up
Expand All @@ -25,22 +24,18 @@ Sentry.init(
// Use the tracing integration to see traces and add performance monitoring
_experiments: {
enableMetrics: true,
beforeSendMetric: (metric) => {
beforeSendMetric: metric => {
return metric;
},
},
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: true,
}),
Sentry.spotlightIntegration({
sidecarUrl: environment.spotlightSidecarUrl,
}),
],
enableLogs: true,
beforeSendLog: (log) => {
beforeSendLog: log => {
return log;
},
// A release identifier
Expand All @@ -52,11 +47,6 @@ Sentry.init(
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 1.0, // If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
},
sentryAngularInit,
);
Expand All @@ -74,6 +64,6 @@ Sentry.init(
useValue: createErrorHandler(),
},
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
52 changes: 19 additions & 33 deletions example/ionic-vue3/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createApp } from 'vue'
import App from './App.vue'
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';

import { IonicVue } from '@ionic/vue';
Expand All @@ -26,10 +26,7 @@ import { localConfig } from './config/local';
/* Theme variables */
import './theme/variables.css';

const app = createApp(App)
.use(IonicVue)
.use(router);

const app = createApp(App).use(IonicVue).use(router);

Sentry.init({
dsn: 'https://7f35532db4f8aca7c7b6992d488b39c1@o447951.ingest.sentry.io/4505912397660160',
Expand All @@ -38,42 +35,31 @@ Sentry.init({
tracingOptions: {
timeout: 1000,
trackComponents: true,
hooks: ["mount", "update", "unmount"]
}
}),
SentryVue.replayCanvasIntegration({
maskAllText: false,
blockAllMedia: false,
hooks: ['mount', 'update', 'unmount'],
},
}),
...(localConfig.spotlightSidecarUrl ? [Sentry.spotlightIntegration({
sidecarUrl: localConfig.spotlightSidecarUrl,
})] : []),
...(localConfig.spotlightSidecarUrl
? [
Sentry.spotlightIntegration({
sidecarUrl: localConfig.spotlightSidecarUrl,
}),
]
: []),
],
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
tracesSampleRate: 1.0,
enableLogs: true,
beforeSendLog: (log) => {
return log;
},
});

siblingOptions: {
vueOptions: {
app: app,
attachErrorHandler: false,
attachProps: false,
},
},
},
// Forward the init method from @sentry/vue
SentryVue.init,
);

SentryVue.init({
app: app,
attachErrorHandler: false,
attachProps: false,
});

router.isReady().then(() => {
app.mount('#app');
app.mount('Hello')
});
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export {
startIdleSpan,
} from '@sentry/core';

export { metrics, replayIntegration, browserTracingIntegration, registerSpanErrorInstrumentation, logger } from '@sentry/browser';
export { metrics, browserTracingIntegration, registerSpanErrorInstrumentation, logger } from '@sentry/browser';

export { pauseAppHangTracking, resumeAppHangTracking } from './wrapper';

Expand Down
7 changes: 2 additions & 5 deletions src/integrations/logEnricherIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const logEnricherIntegration = (): Integration => {
cacheLogContext().then(
() => {
client.on('beforeCaptureLog', (log: Log) => {
processLog(log, client);
processLog(log);
});
},
reason => {
Expand Down Expand Up @@ -69,7 +69,7 @@ async function cacheLogContext(): Promise<void> {
return Promise.resolve();
}

function processLog(log: Log, client: Client): void {
function processLog(log: Log): void {
if (NativeCache === undefined) {
return;
}
Expand All @@ -85,9 +85,6 @@ function processLog(log: Log, client: Client): void {
setLogAttribute(logAttributes, 'os.version', NativeCache.version);
setLogAttribute(logAttributes, 'sentry.release', NativeCache.release);

const replay = client.getIntegrationByName<Integration & { getReplayId: () => string | null }>('Replay');
setLogAttribute(logAttributes, 'sentry.replay_id', replay?.getReplayId());

// Set log.attributes to the variable
log.attributes = logAttributes;
}
2 changes: 0 additions & 2 deletions src/nativeOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export function FilterNativeOptions(
maxBreadcrumbs: options.maxBreadcrumbs,
// maxValueLength: Only available on the JavaScript Layer.
release: options.release,
// replaysOnErrorSampleRate: Only handled on the JavaScript Layer.
// replaysSessionSampleRate: Only handled on the JavaScript Layer.
sampleRate: options.sampleRate,
sendClientReports: options.sendClientReports,
sendDefaultPii: options.sendDefaultPii,
Expand Down
25 changes: 7 additions & 18 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,7 @@ import type { NuxtOptions, VueOptions } from './siblingOptions';
// Direct reference of BrowserTransportOptions is not compatible with strict builds of latest versions of Typescript 5.
type BrowserTransportOptions = Parameters<typeof makeFetchTransport>[0];

type CapacitorBrowserClientReplayOptions = {
/**
* The sample rate for session-long replays.
* 1.0 will record all sessions and 0 will record none.
* @deprecated This option will be dropped on Capacitor V4.
*/
replaysSessionSampleRate?: number;
/**
* The sample rate for sessions that has had an error occur.
* This is independent of `sessionSampleRate`.
* 1.0 will record all sessions and 0 will record none.
* @deprecated This option will be dropped on Capacitor V4.
*/
replaysOnErrorSampleRate?: number;
};

export interface BaseCapacitorOptions
extends CapacitorBrowserClientReplayOptions {
export interface BaseCapacitorOptions {
/**
* Enables crash reporting for native crashes.
* Defaults to `true`.
Expand Down Expand Up @@ -152,6 +135,9 @@ export interface CapacitorOptions
| 'enableMetrics'
| 'replaysOnErrorSampleRate'
| 'replaysSessionSampleRate'
| 'profilesSampleRate'
| 'profileLifecycle'
| 'profileSessionSampleRate'
>,
BaseCapacitorOptions {}

Expand All @@ -166,5 +152,8 @@ export interface CapacitorClientOptions
| 'enableMetrics'
| 'replaysOnErrorSampleRate'
| 'replaysSessionSampleRate'
| 'profilesSampleRate'
| 'profileLifecycle'
| 'profileSessionSampleRate'
>,
BaseCapacitorOptions {}
9 changes: 0 additions & 9 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ export function init(
? getDefaultIntegrations(sharedOptions)
: passedOptions.defaultIntegrations;

if (
browserOptions.replaysSessionSampleRate ||
browserOptions.replaysOnErrorSampleRate
) {
debug.warn(
'Sentry Capacitor options "replaysSessionSampleRate" and "replaysOnErrorSampleRate" will be removed in Capacitor SDK v4.',
);
}

/**
* Mobile options are the options that are only used by the native SDK.
*/
Expand Down
Loading
Loading