Skip to content

Commit

Permalink
Merge branch 'v7' into egou/v7/fix/browser-tracing-latest-route
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardgou-sentry authored Feb 21, 2024
2 parents 38bd3f2 + 046422b commit e102775
Show file tree
Hide file tree
Showing 67 changed files with 810 additions and 266 deletions.
1 change: 1 addition & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ jobs:
version: ${{ steps.version.outputs.group1 }}
force: false
merge_target: master
craft_config_from_merge_target: true
4 changes: 2 additions & 2 deletions .github/workflows/enforce-license-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Enforce License Compliance

on:
push:
branches: [master, develop, release/*]
branches: [master, develop, release/*, v7]
pull_request:
branches: [master, develop]
branches: [master, develop, v7]

jobs:
enforce-license-compliance:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
merge_target:
description: Target branch to merge into. Uses the default branch as a fallback (optional)
required: false
default: master
default: v7
jobs:
release:
runs-on: ubuntu-20.04
Expand All @@ -29,3 +29,5 @@ jobs:
version: ${{ github.event.inputs.version }}
force: ${{ github.event.inputs.force }}
merge_target: ${{ github.event.inputs.merge_target }}
craft_config_from_merge_target: true

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

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

## 7.102.0

- fix: Export session API (#10712)
- fix(core): Fix scope capturing via `captureContext` function (#10737)

## 7.101.1

In version 7.101.0 the `@sentry/hub` package was missing due to a publishing issue. This release contains the package
Expand Down
6 changes: 3 additions & 3 deletions dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/browser-integration-tests",
"version": "7.101.1",
"version": "7.102.0",
"main": "index.js",
"license": "MIT",
"engines": {
Expand Down Expand Up @@ -47,8 +47,8 @@
"@babel/preset-typescript": "^7.16.7",
"@playwright/test": "^1.40.1",
"@sentry-internal/rrweb": "2.11.0",
"@sentry/browser": "7.101.1",
"@sentry/tracing": "7.101.1",
"@sentry/browser": "7.102.0",
"@sentry/tracing": "7.102.0",
"axios": "1.6.0",
"babel-loader": "^8.2.2",
"html-webpack-plugin": "^5.5.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
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/e2e-tests",
"version": "7.101.1",
"version": "7.102.0",
"license": "MIT",
"private": true,
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/node-integration-tests",
"version": "7.101.1",
"version": "7.102.0",
"license": "MIT",
"engines": {
"node": ">=10"
Expand Down Expand Up @@ -29,9 +29,9 @@
"dependencies": {
"@hapi/hapi": "^20.3.0",
"@prisma/client": "3.15.2",
"@sentry/node": "7.101.1",
"@sentry/tracing": "7.101.1",
"@sentry/types": "7.101.1",
"@sentry/node": "7.102.0",
"@sentry/tracing": "7.102.0",
"@sentry/types": "7.102.0",
"@types/mongodb": "^3.6.20",
"@types/mysql": "^2.15.21",
"@types/pg": "^8.6.5",
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/overhead-metrics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "7.101.1",
"version": "7.102.0",
"name": "@sentry-internal/overhead-metrics",
"main": "index.js",
"author": "Sentry",
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/rollup-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/rollup-utils",
"version": "7.101.1",
"version": "7.102.0",
"description": "Rollup utilities used at Sentry for the Sentry JavaScript SDK",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/rollup-utils",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "7.101.1",
"version": "7.102.0",
"npmClient": "yarn"
}
10 changes: 5 additions & 5 deletions packages/angular-ivy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/angular-ivy",
"version": "7.101.1",
"version": "7.102.0",
"description": "Official Sentry SDK for Angular with full Ivy Support",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular-ivy",
Expand All @@ -21,10 +21,10 @@
"rxjs": "^6.5.5 || ^7.x"
},
"dependencies": {
"@sentry/browser": "7.101.1",
"@sentry/core": "7.101.1",
"@sentry/types": "7.101.1",
"@sentry/utils": "7.101.1",
"@sentry/browser": "7.102.0",
"@sentry/core": "7.102.0",
"@sentry/types": "7.102.0",
"@sentry/utils": "7.102.0",
"tslib": "^2.4.1"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/angular",
"version": "7.101.1",
"version": "7.102.0",
"description": "Official Sentry SDK for Angular",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/angular",
Expand All @@ -21,10 +21,10 @@
"rxjs": "^6.5.5 || ^7.x"
},
"dependencies": {
"@sentry/browser": "7.101.1",
"@sentry/core": "7.101.1",
"@sentry/types": "7.101.1",
"@sentry/utils": "7.101.1",
"@sentry/browser": "7.102.0",
"@sentry/core": "7.102.0",
"@sentry/types": "7.102.0",
"@sentry/utils": "7.102.0",
"tslib": "^2.4.1"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/astro",
"version": "7.101.1",
"version": "7.102.0",
"description": "Official Sentry SDK for Astro",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/astro",
Expand Down Expand Up @@ -49,11 +49,11 @@
"astro": ">=3.x || >=4.0.0-beta"
},
"dependencies": {
"@sentry/browser": "7.101.1",
"@sentry/core": "7.101.1",
"@sentry/node": "7.101.1",
"@sentry/types": "7.101.1",
"@sentry/utils": "7.101.1",
"@sentry/browser": "7.102.0",
"@sentry/core": "7.102.0",
"@sentry/node": "7.102.0",
"@sentry/types": "7.102.0",
"@sentry/utils": "7.102.0",
"@sentry/vite-plugin": "^2.8.0"
},
"devDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/browser",
"version": "7.101.1",
"version": "7.102.0",
"description": "Official Sentry SDK for browsers",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
Expand Down Expand Up @@ -29,16 +29,16 @@
"access": "public"
},
"dependencies": {
"@sentry-internal/feedback": "7.101.1",
"@sentry-internal/replay-canvas": "7.101.1",
"@sentry-internal/tracing": "7.101.1",
"@sentry/core": "7.101.1",
"@sentry/replay": "7.101.1",
"@sentry/types": "7.101.1",
"@sentry/utils": "7.101.1"
"@sentry-internal/feedback": "7.102.0",
"@sentry-internal/replay-canvas": "7.102.0",
"@sentry-internal/tracing": "7.102.0",
"@sentry/core": "7.102.0",
"@sentry/replay": "7.102.0",
"@sentry/types": "7.102.0",
"@sentry/utils": "7.102.0"
},
"devDependencies": {
"@sentry-internal/integration-shims": "7.101.1",
"@sentry-internal/integration-shims": "7.102.0",
"@types/md5": "2.1.33",
"btoa": "^1.2.1",
"chai": "^4.1.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/browser/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export {
functionToStringIntegration,
inboundFiltersIntegration,
parameterize,
startSession,
captureSession,
endSession,
} from '@sentry/core';

export {
Expand Down
10 changes: 5 additions & 5 deletions packages/bun/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/bun",
"version": "7.101.1",
"version": "7.102.0",
"description": "Official Sentry SDK for bun",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/bun",
Expand Down Expand Up @@ -29,10 +29,10 @@
"access": "public"
},
"dependencies": {
"@sentry/core": "7.101.1",
"@sentry/node": "7.101.1",
"@sentry/types": "7.101.1",
"@sentry/utils": "7.101.1"
"@sentry/core": "7.102.0",
"@sentry/node": "7.102.0",
"@sentry/types": "7.102.0",
"@sentry/utils": "7.102.0"
},
"devDependencies": {
"bun-types": "latest"
Expand Down
3 changes: 3 additions & 0 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export {
linkedErrorsIntegration,
requestDataIntegration,
parameterize,
startSession,
captureSession,
endSession,
} from '@sentry/core';
export type { SpanStatusType } from '@sentry/core';
export {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/core",
"version": "7.101.1",
"version": "7.102.0",
"description": "Base implementation for all Sentry JavaScript SDKs",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/core",
Expand Down Expand Up @@ -29,8 +29,8 @@
"access": "public"
},
"dependencies": {
"@sentry/types": "7.101.1",
"@sentry/utils": "7.101.1"
"@sentry/types": "7.102.0",
"@sentry/utils": "7.102.0"
},
"scripts": {
"build": "run-p build:transpile build:types",
Expand Down
66 changes: 32 additions & 34 deletions packages/core/src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,50 +378,48 @@ export class Scope implements ScopeInterface {
return this;
}

if (typeof captureContext === 'function') {
const updatedScope = (captureContext as <T>(scope: T) => T)(this);
return updatedScope instanceof Scope ? updatedScope : this;
}
const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;

if (scopeToMerge instanceof Scope) {
const scopeData = scopeToMerge.getScopeData();

if (captureContext instanceof Scope) {
this._tags = { ...this._tags, ...captureContext._tags };
this._extra = { ...this._extra, ...captureContext._extra };
this._contexts = { ...this._contexts, ...captureContext._contexts };
if (captureContext._user && Object.keys(captureContext._user).length) {
this._user = captureContext._user;
this._tags = { ...this._tags, ...scopeData.tags };
this._extra = { ...this._extra, ...scopeData.extra };
this._contexts = { ...this._contexts, ...scopeData.contexts };
if (scopeData.user && Object.keys(scopeData.user).length) {
this._user = scopeData.user;
}
if (captureContext._level) {
this._level = captureContext._level;
if (scopeData.level) {
this._level = scopeData.level;
}
if (captureContext._fingerprint) {
this._fingerprint = captureContext._fingerprint;
if (scopeData.fingerprint.length) {
this._fingerprint = scopeData.fingerprint;
}
if (captureContext._requestSession) {
this._requestSession = captureContext._requestSession;
if (scopeToMerge.getRequestSession()) {
this._requestSession = scopeToMerge.getRequestSession();
}
if (captureContext._propagationContext) {
this._propagationContext = captureContext._propagationContext;
if (scopeData.propagationContext) {
this._propagationContext = scopeData.propagationContext;
}
} else if (isPlainObject(captureContext)) {
// eslint-disable-next-line no-param-reassign
captureContext = captureContext as ScopeContext;
this._tags = { ...this._tags, ...captureContext.tags };
this._extra = { ...this._extra, ...captureContext.extra };
this._contexts = { ...this._contexts, ...captureContext.contexts };
if (captureContext.user) {
this._user = captureContext.user;
} else if (isPlainObject(scopeToMerge)) {
const scopeContext = captureContext as ScopeContext;
this._tags = { ...this._tags, ...scopeContext.tags };
this._extra = { ...this._extra, ...scopeContext.extra };
this._contexts = { ...this._contexts, ...scopeContext.contexts };
if (scopeContext.user) {
this._user = scopeContext.user;
}
if (captureContext.level) {
this._level = captureContext.level;
if (scopeContext.level) {
this._level = scopeContext.level;
}
if (captureContext.fingerprint) {
this._fingerprint = captureContext.fingerprint;
if (scopeContext.fingerprint) {
this._fingerprint = scopeContext.fingerprint;
}
if (captureContext.requestSession) {
this._requestSession = captureContext.requestSession;
if (scopeContext.requestSession) {
this._requestSession = scopeContext.requestSession;
}
if (captureContext.propagationContext) {
this._propagationContext = captureContext.propagationContext;
if (scopeContext.propagationContext) {
this._propagationContext = scopeContext.propagationContext;
}
}

Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/tracing/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ export class Span implements SpanInterface {

protected _traceId: string;
protected _spanId: string;
protected _parentSpanId?: string;
protected _parentSpanId?: string | undefined;
protected _sampled: boolean | undefined;
protected _name?: string;
protected _name?: string | undefined;
protected _attributes: SpanAttributes;
/** Epoch timestamp in seconds when the span started. */
protected _startTime: number;
/** Epoch timestamp in seconds when the span ended. */
protected _endTime?: number;
protected _endTime?: number | undefined;
/** Internal keeper of the status */
protected _status?: SpanStatusType | string;
protected _status?: SpanStatusType | string | undefined;

private _logMessage?: string;

Expand Down Expand Up @@ -385,7 +385,7 @@ export class Span implements SpanInterface {
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
): Span {
): SpanInterface {
const childSpan = new Span({
...spanContext,
parentSpanId: this._spanId,
Expand Down
Loading

0 comments on commit e102775

Please sign in to comment.