Skip to content

Commit

Permalink
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
Browse files Browse the repository at this point in the history
…959-captureFeedback-attachements
  • Loading branch information
antonis committed Dec 13, 2024
2 parents c837f8e + 9831482 commit 08a5805
Show file tree
Hide file tree
Showing 77 changed files with 285 additions and 214 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ jobs:
runs-on: ubuntu-latest
name: "Release a new version"
steps:
- name: Get auth token
id: token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
with:
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
- name: Check out current commit (${{ github.sha }})
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_RELEASE_PAT }}
token: ${{ steps.token.outputs.token }}
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v4
Expand All @@ -31,7 +37,7 @@ jobs:
- name: Prepare release
uses: getsentry/action-prepare-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }}
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
with:
version: ${{ github.event.inputs.version }}
force: ${{ github.event.inputs.force }}
Expand Down
20 changes: 15 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,41 @@
});
```

- Adds feedback form ([#4320](https://github.com/getsentry/sentry-react-native/pull/4328))
- Adds feedback form (beta) ([#4320](https://github.com/getsentry/sentry-react-native/pull/4328))

You can add the form component in your UI and customise it like:
You can add the form component in your UI like:
```jsx
import { FeedbackForm } from "@sentry/react-native";
...
<FeedbackForm/>
```
Check [the documentation](https://docs.sentry.io/platforms/react-native/user-feedback/) for more configuration options.

- Export `Span` type from `@sentry/types` ([#4345](https://github.com/getsentry/sentry-react-native/pull/4345))


### Fixes

- Return `lastEventId` export from `@sentry/core` ([#4315](https://github.com/getsentry/sentry-react-native/pull/4315))
- Don't log file not found errors when loading envs in `sentry-expo-upload-sourcemaps` ([#4332](https://github.com/getsentry/sentry-react-native/pull/4332))
- Navigation Span should have no parent by default ([#4326](https://github.com/getsentry/sentry-react-native/pull/4326))
- Disable HTTP Client Errors on iOS ([#4347](https://github.com/getsentry/sentry-react-native/pull/4347))

### Changes

- Falsy values of `options.environment` (empty string, undefined...) default to `production`

### Dependencies

- Bump CLI from v2.38.2 to v2.39.1 ([#4305](https://github.com/getsentry/sentry-react-native/pull/4305), [#4316](https://github.com/getsentry/sentry-react-native/pull/4316))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2391)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.38.2...2.39.1)
- Bump Android SDK from v7.18.0 to v7.18.1 ([#4329](https://github.com/getsentry/sentry-react-native/pull/4329))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7181)
- [diff](https://github.com/getsentry/sentry-java/compare/7.18.0...7.18.1)
- Bump Android SDK from v7.18.0 to v7.19.0 ([#4329](https://github.com/getsentry/sentry-react-native/pull/4329), [#4365](https://github.com/getsentry/sentry-react-native/pull/4365))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7190)
- [diff](https://github.com/getsentry/sentry-java/compare/7.18.0...7.19.0)
- Bump JavaScript SDK from v8.40.0 to v8.44.0 ([#4351](https://github.com/getsentry/sentry-react-native/pull/4351), [#4325](https://github.com/getsentry/sentry-react-native/pull/4325))
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#8440)
- [diff](https://github.com/getsentry/sentry-javascript/compare/8.40.0...8.44.0)

## 6.4.0

Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"devDependencies": {
"@babel/preset-env": "^7.25.3",
"@babel/preset-typescript": "^7.18.6",
"@sentry/core": "8.44.0",
"@sentry/react-native": "6.4.0",
"@sentry/utils": "8.40.0",
"@types/node": "^20.9.3",
"@types/react": "^18.2.64",
"appium": "2.4.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/utils');
const { logger } = require('@sentry/core');
logger.enable();

const args = parseArgs(argv.slice(2));
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/patch-scripts/rn.patch.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
const { argv, env } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/utils');
const { logger } = require('@sentry/core');
logger.enable();

const SENTRY_RELEASE = env.SENTRY_RELEASE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/utils');
const { logger } = require('@sentry/core');
logger.enable();

const args = parseArgs(argv.slice(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/utils');
const { logger } = require('@sentry/core');
logger.enable();

const args = parseArgs(argv.slice(2));
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const { argv } = require('process');

const parseArgs = require('minimist');
const { logger } = require('@sentry/utils');
const { logger } = require('@sentry/core');
logger.enable();

const args = parseArgs(argv.slice(2));
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { argv } = require('process');
const xcode = require('xcode');
const parseArgs = require('minimist');
const semver = require('semver');
const { logger } = require('@sentry/utils');
const { logger } = require('@sentry/core');
logger.enable();

const args = parseArgs(argv.slice(2));
Expand Down
2 changes: 1 addition & 1 deletion packages/core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ android {

dependencies {
implementation 'com.facebook.react:react-native:+'
api 'io.sentry:sentry-android:7.18.1'
api 'io.sentry:sentry-android:7.19.0'
}
18 changes: 9 additions & 9 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"test:sdk": "npx jest",
"test:tools": "npx jest --config jest.config.tools.js",
"test:watch": "npx jest --watch",
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/react @sentry/types @sentry/utils",
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/react @sentry/types",
"fix": "npx run-s fix:eslint fix:prettier",
"fix:eslint": "eslint --config .eslintrc.js --fix .",
"fix:prettier": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --write \"{src,test,scripts,plugin/src}/**/**.ts\"",
Expand Down Expand Up @@ -66,21 +66,21 @@
},
"dependencies": {
"@sentry/babel-plugin-component-annotate": "2.20.1",
"@sentry/browser": "8.40.0",
"@sentry/browser": "8.44.0",
"@sentry/cli": "2.39.1",
"@sentry/core": "8.40.0",
"@sentry/react": "8.40.0",
"@sentry/types": "8.40.0",
"@sentry/utils": "8.40.0"
"@sentry/core": "8.44.0",
"@sentry/react": "8.44.0",
"@sentry/types": "8.44.0",
"@sentry/utils": "8.44.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@expo/metro-config": "0.19.5",
"@mswjs/interceptors": "^0.25.15",
"@react-native/babel-preset": "0.76.3",
"@sentry-internal/eslint-config-sdk": "8.40.0",
"@sentry-internal/eslint-plugin-sdk": "8.40.0",
"@sentry-internal/typescript": "8.40.0",
"@sentry-internal/eslint-config-sdk": "8.44.0",
"@sentry-internal/eslint-plugin-sdk": "8.44.0",
"@sentry-internal/typescript": "8.44.0",
"@sentry/wizard": "3.36.0",
"@testing-library/react-native": "^12.7.2",
"@types/jest": "^29.5.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/breadcrumb.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { severityLevelFromString } from '@sentry/core';
import type { Breadcrumb, SeverityLevel } from '@sentry/types';
import { severityLevelFromString } from '@sentry/utils';

export const DEFAULT_BREADCRUMB_LEVEL: SeverityLevel = 'info';

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/js/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { eventFromException, eventFromMessage } from '@sentry/browser';
import { BaseClient } from '@sentry/core';
import { BaseClient, dateTimestampInSeconds, logger, SentryError } from '@sentry/core';
import type {
ClientReportEnvelope,
ClientReportItem,
Expand All @@ -11,7 +11,6 @@ import type {
TransportMakeRequestResponse,
UserFeedback,
} from '@sentry/types';
import { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';
import { Alert } from 'react-native';

import { getDevServer } from './integrations/debugsymbolicatorutils';
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type {
Exception,
SendFeedbackParams,
SeverityLevel,
Span,
StackFrame,
Stacktrace,
Thread,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/debugsymbolicator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '@sentry/core';
import type { Event, EventHint, Exception, Integration, StackFrame as SentryStackFrame } from '@sentry/types';
import { logger } from '@sentry/utils';

import type { ExtendedError } from '../utils/error';
import { getFramesToPop, isErrorLike } from '../utils/error';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '@sentry/core';
import type { StackFrame as SentryStackFrame } from '@sentry/types';
import { logger } from '@sentry/utils';

import { ReactNativeLibraries } from '../utils/rnlibraries';
import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/devicecontext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable complexity */
import { logger, severityLevelFromString } from '@sentry/core';
import type { Client, Event, EventHint, Integration } from '@sentry/types';
import { logger, severityLevelFromString } from '@sentry/utils';
import { AppState } from 'react-native';

import { breadcrumbFromObject } from '../breadcrumb';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/modulesloader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '@sentry/core';
import type { Event, Integration } from '@sentry/types';
import { logger } from '@sentry/utils';

import { NATIVE } from '../wrapper';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/nativelinkederrors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { exceptionFromError } from '@sentry/browser';
import { isInstanceOf, isPlainObject, isString } from '@sentry/core';
import type {
Client,
DebugImage,
Expand All @@ -10,7 +11,6 @@ import type {
StackFrame,
StackParser,
} from '@sentry/types';
import { isInstanceOf, isPlainObject, isString } from '@sentry/utils';

import type { NativeStackFrames } from '../NativeRNSentry';
import { NATIVE } from '../wrapper';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { captureException, getClient, getCurrentScope } from '@sentry/core';
import { addExceptionMechanism, captureException, getClient, getCurrentScope, logger } from '@sentry/core';
import type { EventHint, Integration, SeverityLevel } from '@sentry/types';
import { addExceptionMechanism, logger } from '@sentry/utils';

import { createSyntheticError, isErrorLike } from '../utils/error';
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@sentry/utils';
import { logger } from '@sentry/core';

import { ReactNativeLibraries } from '../utils/rnlibraries';
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/sdkinfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '@sentry/core';
import type { Event, Integration, Package, SdkInfo as SdkInfoType } from '@sentry/types';
import { logger } from '@sentry/utils';

import { isExpoGo, notWeb } from '../utils/environment';
import { SDK_NAME, SDK_PACKAGE_NAME, SDK_VERSION } from '../version';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/spotlight.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger, serializeEnvelope } from '@sentry/core';
import type { BaseTransportOptions, Client, ClientOptions, Envelope, Integration } from '@sentry/types';
import { logger, serializeEnvelope } from '@sentry/utils';

import { ReactNativeLibraries } from '../utils/rnlibraries';
import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/integrations/viewhierarchy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '@sentry/core';
import type { Attachment, Event, EventHint, Integration } from '@sentry/types';
import { logger } from '@sentry/utils';

import { NATIVE } from '../wrapper';

Expand Down
71 changes: 69 additions & 2 deletions packages/core/src/js/profiling/cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,72 @@
import { makeFifoCache } from '@sentry/utils';

import type { AndroidCombinedProfileEvent, CombinedProfileEvent } from './types';

export const PROFILE_QUEUE = makeFifoCache<string, CombinedProfileEvent | AndroidCombinedProfileEvent>(20);

/**
* Creates a cache that evicts keys in fifo order
* @param size {Number}
*/
function makeFifoCache<Key extends string, Value>(
size: number,
): {
get: (key: Key) => Value | undefined;
add: (key: Key, value: Value) => void;
delete: (key: Key) => boolean;
clear: () => void;
size: () => number;
} {
// Maintain a fifo queue of keys, we cannot rely on Object.keys as the browser may not support it.
let evictionOrder: Key[] = [];
let cache: Record<string, Value> = {};

return {
add(key: Key, value: Value) {
while (evictionOrder.length >= size) {
// shift is O(n) but this is small size and only happens if we are
// exceeding the cache size so it should be fine.
const evictCandidate = evictionOrder.shift();

if (evictCandidate !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete cache[evictCandidate];
}
}

// in case we have a collision, delete the old key.
if (cache[key]) {
this.delete(key);
}

evictionOrder.push(key);
cache[key] = value;
},
clear() {
cache = {};
evictionOrder = [];
},
get(key: Key): Value | undefined {
return cache[key];
},
size() {
return evictionOrder.length;
},
// Delete cache key and return true if it existed, false otherwise.
delete(key: Key): boolean {
if (!cache[key]) {
return false;
}

// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete cache[key];

for (let i = 0; i < evictionOrder.length; i++) {
if (evictionOrder[i] === key) {
evictionOrder.splice(i, 1);
break;
}
}

return true;
},
};
}
2 changes: 1 addition & 1 deletion packages/core/src/js/profiling/convertHermesProfile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '@sentry/core';
import type { FrameId, StackId, ThreadCpuFrame, ThreadCpuSample, ThreadCpuStack, ThreadId } from '@sentry/types';
import { logger } from '@sentry/utils';

import { MAX_PROFILE_DURATION_MS } from './constants';
import type * as Hermes from './hermes';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/profiling/debugid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GLOBAL_OBJ, logger } from '@sentry/core';
import type { DebugImage } from '@sentry/types';
import { GLOBAL_OBJ, logger } from '@sentry/utils';

import { DEFAULT_BUNDLE_NAME } from './hermes';

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/js/profiling/integration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable complexity */
import { getActiveSpan, getClient, spanIsSampled } from '@sentry/core';
import { getActiveSpan, getClient, logger, spanIsSampled, uuid4 } from '@sentry/core';
import type { Envelope, Event, Integration, Span, ThreadCpuProfile } from '@sentry/types';
import { logger, uuid4 } from '@sentry/utils';
import { Platform } from 'react-native';

import type { ReactNativeClient } from '../client';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/js/profiling/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable complexity */
import { forEachEnvelopeItem, logger } from '@sentry/core';
import type { Envelope, Event, ThreadCpuProfile } from '@sentry/types';
import { forEachEnvelopeItem, logger } from '@sentry/utils';

import { getDefaultEnvironment } from '../utils/environment';
import { getDebugMetadata } from './debugid';
Expand Down
Loading

0 comments on commit 08a5805

Please sign in to comment.