Skip to content

feat: Tracing + Reduced Bundle Size + build updates #2038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5007b5c
feat: Tracing Integration
HazAT Apr 24, 2019
c4c8f60
feat: Update dependencies
HazAT Apr 25, 2019
38ddce2
fix: Remove opentracing package since code moved into integration
HazAT Apr 25, 2019
76c6ed6
fix: Ignore tsbuildinfo
HazAT Apr 25, 2019
047ce98
feat: Tracing integration + refactorings
HazAT Apr 25, 2019
6f9a514
fix: linter
HazAT Apr 25, 2019
48863dc
feat: Add more options to tracing integration
HazAT Apr 26, 2019
33fe94d
ref: Small internal refactoring
HazAT Apr 30, 2019
bae0cd1
meta: Changelog
HazAT Apr 30, 2019
c03f26a
Merge branch 'master' into feat/tracing
HazAT Apr 30, 2019
ee574e2
feat: Move transaction to scope
HazAT Apr 30, 2019
399f5ba
feat: Merge
HazAT Apr 30, 2019
83a5e74
fix: Changelog
HazAT Apr 30, 2019
6cc6006
fix: Tests
HazAT Apr 30, 2019
3d2c702
fix: Run yarn install
HazAT May 2, 2019
7c423c7
fix: Also clone span
HazAT May 3, 2019
5630d0f
Merge branch 'master' into feat/tracing
HazAT May 3, 2019
8e05938
meta: Changelog and version bump
HazAT May 3, 2019
d80ef9c
meta: Changelog
HazAT May 3, 2019
eae4e3d
merge master
HazAT May 3, 2019
b9f5302
ci: Remove saucelabs test
HazAT May 3, 2019
cca0d27
fix: Docs error
HazAT May 3, 2019
31aa06c
fix: Use utils in integrations, Remove incremental mode
HazAT May 3, 2019
be5bee5
fix: Linting
HazAT May 3, 2019
90d8a6a
ref: Remove async/await syntax
HazAT May 7, 2019
df8e5b8
Merge branch 'master' into feat/tracing
HazAT May 8, 2019
5f7736d
feat: SpanContext to Span
HazAT May 8, 2019
21d76f4
feat: CR
HazAT May 8, 2019
3c775eb
fix: CR
HazAT May 8, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ packages/*/esm/
coverage/
scratch/
*.pyc
*.tsbuildinfo

# logs
yarn-error.log
Expand Down
9 changes: 0 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ cache:

matrix:
fast_finish: true
allow_failures:
- script: scripts/browser-saucelabs.sh

stages:
- Test
Expand Down Expand Up @@ -70,13 +68,6 @@ jobs:
chrome: stable
firefox: latest
script: scripts/raven-js.sh
- stage: Saucelabs
name: '@sentry/browser - SauceLabs tests'
if: fork = false
node_js: '8'
addons:
sauce_connect: true
script: scripts/browser-saucelabs.sh
- stage: Deploy
name: '@sentry/packages - pack and zeus upload'
node_js: '8'
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Unreleased

- [opentracing] ref: Removed opentracing package
- [integrations] feat: Add tracing integration
- [hub] feat: Add tracing related function to scope and hub (`Scope.startSpan`, `Scope.setSpan`, `Hub.traceHeaders`)
- [hub] feat: Add new function to Scope `setContext`
- [hub] feat: Add new function to Scope `setTransaction`

## 5.1.3

- [browser] fix: GlobalHandler integration sometimes receives Event objects as message: Fix #1949
Expand Down
2 changes: 1 addition & 1 deletion dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { resolve } from 'path';
import tslint from 'danger-plugin-tslint';
import { prettyResults } from 'danger-plugin-tslint/dist/prettyResults';

const packages = ['browser', 'core', 'hub', 'integrations', 'opentracing', 'minimal', 'node', 'types', 'utils'];
const packages = ['browser', 'core', 'hub', 'integrations', 'minimal', 'node', 'types', 'utils'];

export default async () => {
if (!danger.github) {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.4.0",
"version": "5.1.3",
"version": "5.2.0-beta.0",
"packages": "packages/*",
"ignore": "raven-*",
"npmClient": "yarn",
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,31 @@
"packages/utils"
],
"devDependencies": {
"@google-cloud/storage": "^2.3.1",
"@google-cloud/storage": "^2.5.0",
"@strictsoftware/typedoc-plugin-monorepo": "^0.2.1",
"@types/chai": "^4.1.3",
"@types/jest": "^24.0.11",
"@types/mocha": "^5.2.0",
"@types/node": "^11.11.3",
"@types/node": "^11.13.7",
"@types/raven": "^2.5.1",
"@types/sinon": "^7.0.10",
"@types/sinon": "^7.0.11",
"chai": "^4.1.2",
"codecov": "^3.0.2",
"danger": "^7.0.14",
"codecov": "^3.3.0",
"danger": "^7.1.3",
"danger-plugin-tslint": "^2.0.0",
"jest": "^24.5.0",
"lerna": "3.13.1",
"mocha": "^6.0.2",
"jest": "^24.7.1",
"lerna": "3.13.4",
"mocha": "^6.1.4",
"npm-run-all": "^4.1.2",
"prettier": "^1.14.0",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"replace-in-file": "^3.4.4",
"replace-in-file": "^4.0.0",
"rimraf": "^2.6.3",
"sinon": "^7.2.7",
"ts-jest": "^24.0.0",
"tslint": "^5.14.0",
"sinon": "^7.3.2",
"ts-jest": "^24.0.2",
"tslint": "^5.16.0",
"typedoc": "^0.14.2",
"typescript": "^3.3.3333",
"typescript": "^3.4.5",
"typescript-tslint-plugin": "^0.3.1"
}
}
1 change: 1 addition & 0 deletions packages/browser/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
!/dist/**/*
!/build/**/*
!/esm/**/*
*.tsbuildinfo
32 changes: 16 additions & 16 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/browser",
"version": "5.1.3",
"version": "5.2.0-beta.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 All @@ -16,17 +16,17 @@
"access": "public"
},
"dependencies": {
"@sentry/core": "5.1.2",
"@sentry/types": "5.1.0",
"@sentry/utils": "5.1.2",
"@sentry/core": "5.2.0-beta.0",
"@sentry/types": "5.2.0-beta.0",
"@sentry/utils": "5.2.0-beta.0",
"tslib": "^1.9.3"
},
"devDependencies": {
"@types/md5": "2.1.33",
"chai": "^4.1.2",
"jest": "^24.5.0",
"jsdom": "^14.0.0",
"karma": "^4.0.1",
"jest": "^24.7.1",
"jsdom": "^15.0.0",
"karma": "^4.1.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-failed-reporter": "0.0.3",
Expand All @@ -39,19 +39,19 @@
"karma-typescript": "^4.0.0",
"karma-typescript-es6-transform": "^4.0.0",
"npm-run-all": "^4.1.2",
"prettier": "^1.16.4",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"rimraf": "^2.6.3",
"rollup": "^1.6.0",
"rollup-plugin-commonjs": "^9.2.1",
"rollup": "^1.10.1",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-license": "^0.8.1",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-terser": "^4.0.4",
"rollup-plugin-typescript2": "^0.20.1",
"sinon": "^7.2.7",
"tslint": "^5.14.0",
"typescript": "^3.3.3333",
"webpack": "^4.29.6"
"rollup-plugin-typescript2": "^0.21.0",
"sinon": "^7.3.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5",
"webpack": "^4.30.0"
},
"scripts": {
"build": "run-s build:dist build:esm build:bundle",
Expand Down
4 changes: 1 addition & 3 deletions packages/browser/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ const plugins = [
include: ['*.ts+(|x)', '**/*.ts+(|x)', '../**/*.ts+(|x)'],
}),
resolve({
module: true,
browser: false,
modulesOnly: false,
mainFields: ['module'],
}),
commonjs(),
];
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function onLoad(callback: () => void): void {
*
* @param timeout Maximum time in ms the client should wait.
*/
export async function flush(timeout?: number): Promise<boolean> {
export function flush(timeout?: number): Promise<boolean> {
const client = getCurrentHub().getClient<BrowserClient>();
if (client) {
return client.flush(timeout);
Expand All @@ -138,7 +138,7 @@ export async function flush(timeout?: number): Promise<boolean> {
*
* @param timeout Maximum time in ms the client should wait.
*/
export async function close(timeout?: number): Promise<boolean> {
export function close(timeout?: number): Promise<boolean> {
const client = getCurrentHub().getClient<BrowserClient>();
if (client) {
return client.close(timeout);
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/transports/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export abstract class BaseTransport implements Transport {
/**
* @inheritDoc
*/
public async sendEvent(_: Event): Promise<Response> {
public sendEvent(_: Event): Promise<Response> {
throw new SentryError('Transport Class has to implement `sendEvent` method');
}

/**
* @inheritDoc
*/
public async close(timeout?: number): Promise<boolean> {
public close(timeout?: number): Promise<boolean> {
return this._buffer.drain(timeout);
}
}
2 changes: 1 addition & 1 deletion packages/browser/src/transports/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class FetchTransport extends BaseTransport {
/**
* @inheritDoc
*/
public async sendEvent(event: Event): Promise<Response> {
public sendEvent(event: Event): Promise<Response> {
const defaultOptions: RequestInit = {
body: JSON.stringify(event),
method: 'POST',
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/transports/xhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class XHRTransport extends BaseTransport {
/**
* @inheritDoc
*/
public async sendEvent(event: Event): Promise<Response> {
public sendEvent(event: Event): Promise<Response> {
return this._buffer.add(
new Promise<Response>((resolve, reject) => {
const request = new XMLHttpRequest();
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const SDK_NAME = 'sentry.javascript.browser';
export const SDK_VERSION = '5.1.3';
export const SDK_VERSION = '5.2.0-beta.0';
2 changes: 1 addition & 1 deletion packages/browser/test/mocks/simpletransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Event, Response, Status } from '../../src';
import { BaseTransport } from '../../src/transports';

export class SimpleTransport extends BaseTransport {
public async sendEvent(_: Event): Promise<Response> {
public sendEvent(_: Event): Promise<Response> {
return this._buffer.add(
Promise.resolve({
status: Status.fromHttpCode(200),
Expand Down
1 change: 1 addition & 0 deletions packages/core/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*
!/dist/**/*
!/esm/**/*
*.tsbuildinfo
18 changes: 9 additions & 9 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry/core",
"version": "5.1.2",
"version": "5.2.0-beta.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 All @@ -16,20 +16,20 @@
"access": "public"
},
"dependencies": {
"@sentry/hub": "5.1.2",
"@sentry/minimal": "5.1.2",
"@sentry/types": "5.1.0",
"@sentry/utils": "5.1.2",
"@sentry/hub": "5.2.0-beta.0",
"@sentry/minimal": "5.2.0-beta.0",
"@sentry/types": "5.2.0-beta.0",
"@sentry/utils": "5.2.0-beta.0",
"tslib": "^1.9.3"
},
"devDependencies": {
"jest": "^24.5.0",
"jest": "^24.7.1",
"npm-run-all": "^4.1.2",
"prettier": "^1.16.4",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"rimraf": "^2.6.3",
"tslint": "^5.14.0",
"typescript": "^3.3.3333"
"tslint": "^5.16.0",
"typescript": "^3.4.5"
},
"scripts": {
"build": "run-p build:es5 build:esm",
Expand Down
30 changes: 16 additions & 14 deletions packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,26 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
/**
* @inheritDoc
*/
public async flush(timeout?: number): Promise<boolean> {
const clientReady = await this._isClientProcessing(timeout);
if (this._processingInterval) {
clearInterval(this._processingInterval);
}
const transportFlushed = await this._getBackend()
.getTransport()
.close(timeout);
return clientReady && transportFlushed;
public flush(timeout?: number): Promise<boolean> {
return this._isClientProcessing(timeout).then(clientReady => {
if (this._processingInterval) {
clearInterval(this._processingInterval);
}
return this._getBackend()
.getTransport()
.close(timeout)
.then(transportFlushed => clientReady && transportFlushed);
});
}

/**
* @inheritDoc
*/
public async close(timeout?: number): Promise<boolean> {
const result = await this.flush(timeout);
this.getOptions().enabled = false;
return result;
public close(timeout?: number): Promise<boolean> {
return this.flush(timeout).then(result => {
this.getOptions().enabled = false;
return result;
});
}

/**
Expand All @@ -205,7 +207,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
}

/** Waits for the client to be done with processing. */
protected async _isClientProcessing(timeout?: number): Promise<boolean> {
protected _isClientProcessing(timeout?: number): Promise<boolean> {
return new Promise<boolean>(resolve => {
let ticked: number = 0;
const tick: number = 1;
Expand Down
19 changes: 4 additions & 15 deletions packages/core/src/integrations/inboundfilters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { addGlobalEventProcessor, getCurrentHub } from '@sentry/hub';
import { Event, Integration } from '@sentry/types';
import { getEventDescription, isRegExp, logger } from '@sentry/utils';
import { getEventDescription, isMatchingPattern, logger } from '@sentry/utils';

// "Script error." is hard coded into browsers for errors that it can't read.
// this is the result of a script being pulled in from an external domain and CORS.
Expand Down Expand Up @@ -102,7 +102,7 @@ export class InboundFilters implements Integration {

return this._getPossibleEventMessages(event).some(message =>
// Not sure why TypeScript complains here...
(options.ignoreErrors as Array<RegExp | string>).some(pattern => this._isMatchingPattern(message, pattern)),
(options.ignoreErrors as Array<RegExp | string>).some(pattern => isMatchingPattern(message, pattern)),
);
}

Expand All @@ -113,7 +113,7 @@ export class InboundFilters implements Integration {
return false;
}
const url = this._getEventFilterUrl(event);
return !url ? false : options.blacklistUrls.some(pattern => this._isMatchingPattern(url, pattern));
return !url ? false : options.blacklistUrls.some(pattern => isMatchingPattern(url, pattern));
}

/** JSDoc */
Expand All @@ -123,7 +123,7 @@ export class InboundFilters implements Integration {
return true;
}
const url = this._getEventFilterUrl(event);
return !url ? true : options.whitelistUrls.some(pattern => this._isMatchingPattern(url, pattern));
return !url ? true : options.whitelistUrls.some(pattern => isMatchingPattern(url, pattern));
}

/** JSDoc */
Expand All @@ -140,17 +140,6 @@ export class InboundFilters implements Integration {
};
}

/** JSDoc */
private _isMatchingPattern(value: string, pattern: RegExp | string): boolean {
if (isRegExp(pattern)) {
return (pattern as RegExp).test(value);
}
if (typeof pattern === 'string') {
return value.includes(pattern);
}
return false;
}

/** JSDoc */
private _getPossibleEventMessages(event: Event): string[] {
if (event.message) {
Expand Down
Loading