Skip to content

Commit

Permalink
Merge pull request #1484 from bugsnag/release/v7.11.0
Browse files Browse the repository at this point in the history
Release v7.11.0
  • Loading branch information
djskinner authored Jul 26, 2021
2 parents 3d86cc6 + a773072 commit aa298b7
Show file tree
Hide file tree
Showing 81 changed files with 1,683 additions and 261 deletions.
4 changes: 2 additions & 2 deletions .buildkite/node-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ steps:
run: node-maze-runner
use-aliases: true
verbose: true
command: ["-e", "koa.feature", "-e", "koa-1x.feature", "-e", "webpack.feature"]
command: ["-e", "koa.feature", "-e", "koa-1x.feature", "-e", "koa_disabled.feature", "-e", "koa-1x_disabled.feature", "-e", "webpack.feature"]
env:
NODE_VERSION: "4"

Expand All @@ -37,7 +37,7 @@ steps:
run: node-maze-runner
use-aliases: true
verbose: true
command: ["-e", "koa.feature", "-e", "koa-1x.feature"]
command: ["-e", "koa.feature", "-e", "koa-1x.feature", "-e", "koa_disabled.feature", "-e", "koa-1x_disabled.feature"]
env:
NODE_VERSION: "6"

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/react-native-cli-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ steps:

- label: ':ios: Init and build RN 0.64 ipa (Hermes)'
key: 'rn-0-64-hermes-ipa'
timeout_in_minutes: 30
timeout_in_minutes: 60
agents:
queue: 'opensource-mac-cocoa-11'
env:
Expand Down
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
# Changelog

## 7.11.0 (2021-07-26)

### Added

- Server framework plugins now honour the `autoDetectErrors` configuration option [#1464](https://github.com/bugsnag/bugsnag-js/pull/1464)

### Changed

- (react-native): Update bugsnag-cocoa to v6.10.2
- Fix ThreadSanitizer data race warning in `BSGAppHangDetector`. [bugsnag-cocoa#1153](https://github.com/bugsnag/bugsnag-cocoa/pull/1153)
- Remove (duplicated) `user` information from `metaData`. [bugsnag-cocoa#1151](https://github.com/bugsnag/bugsnag-cocoa/pull/1151)
- Fix a potential stack overflow in `+[BugsnagThread allThreadsWithCurrentThreadBacktrace:]`. [bugsnag-cocoa#1148](https://github.com/bugsnag/bugsnag-cocoa/pull/1148)
- Fix `NSNull` handling in `+[BugsnagError errorFromJson:]` and `+[BugsnagStackframe frameFromJson:]`. [bugsnag-cocoa#1143](https://github.com/bugsnag/bugsnag-cocoa/pull/1143)
- Fix a rare crash in `bsg_ksmachgetThreadQueueName`. [bugsnag-cocoa#1147](https://github.com/bugsnag/bugsnag-cocoa/pull/1147)
- (react-native): Update bugsnag-android to v5.10.1
- Prefer `calloc()` to `malloc()` in NDK code
[bugsnag-android#1320](https://github.com/bugsnag/bugsnag-android/pull/1320)
- Ensure correct value always collected for activeScreen
[bugsnag-android#1322](https://github.com/bugsnag/bugsnag-android/pull/1322)
- Capture process name in Event payload
[bugsnag-android#1318](https://github.com/bugsnag/bugsnag-android/pull/1318)
- Avoid unnecessary BroadcastReceiver registration for monitoring device orientation
[bugsnag-android#1303](https://github.com/bugsnag/bugsnag-android/pull/1303)
- Register system callbacks on background thread
[bugsnag-android#1292](https://github.com/bugsnag/bugsnag-android/pull/1292)
- Fix rare NullPointerExceptions from ConnectivityManager
[bugsnag-android#1311](https://github.com/bugsnag/bugsnag-android/pull/1311)
- Respect manual setting of context
[bugsnag-android#1310](https://github.com/bugsnag/bugsnag-android/pull/1310)
- Handle interrupt when shutting down executors
[bugsnag-android#1315](https://github.com/bugsnag/bugsnag-android/pull/1315)
- React Native: allow serializing enabledBreadcrumbTypes as null
[bugsnag-android#1316](https://github.com/bugsnag/bugsnag-android/pull/1316)
- Unity: Properly handle ANRs after multiple calls to autoNotify and autoDetectAnrs
[bugsnag-android#1265](https://github.com/bugsnag/bugsnag-android/pull/1265)
- Cache value of app.backgroundWorkRestricted
[bugsnag-android#1275](https://github.com/bugsnag/bugsnag-android/pull/1275)
- Optimize execution of callbacks
[bugsnag-android#1276](https://github.com/bugsnag/bugsnag-android/pull/1276)
- Optimize implementation of internal state change observers
[bugsnag-android#1274](https://github.com/bugsnag/bugsnag-android/pull/1274)
- Optimize metadata implementation by reducing type casts
[bugsnag-android#1277](https://github.com/bugsnag/bugsnag-android/pull/1277)
- Trim stacktraces to <200 frames before attempting to construct POJOs
[bugsnag-android#1281](https://github.com/bugsnag/bugsnag-android/pull/1281)
- Use direct field access when adding breadcrumbs and state updates
[bugsnag-android#1279](https://github.com/bugsnag/bugsnag-android/pull/1279)
- Avoid using regex to validate api key
[bugsnag-android#1282](https://github.com/bugsnag/bugsnag-android/pull/1282)
- Discard unwanted automatic data earlier where possible
[bugsnag-android#1280](https://github.com/bugsnag/bugsnag-android/pull/1280)
- Enable ANR handling on immediately if started from the main thread
[bugsnag-android#1283](https://github.com/bugsnag/bugsnag-android/pull/1283)
- Include `app.binaryArch` in all events
[bugsnag-android#1287](https://github.com/bugsnag/bugsnag-android/pull/1287)
- Cache results from PackageManager
[bugsnag-android#1288](https://github.com/bugsnag/bugsnag-android/pull/1288)
- Use ring buffer to store breadcrumbs
[bugsnag-android#1286](https://github.com/bugsnag/bugsnag-android/pull/1286)
- Avoid expensive set construction in Config constructor
[bugsnag-android#1289](https://github.com/bugsnag/bugsnag-android/pull/1289)
- Replace calls to String.format() with concatenation
[bugsnag-android#1293](https://github.com/bugsnag/bugsnag-android/pull/1293)
- Optimize capture of thread traces
[bugsnag-android#1300](https://github.com/bugsnag/bugsnag-android/pull/1300)

### Fixed

- Breadcrumbs will now be left when `enabledBreadcrumbTypes` is `null` [#1466](https://github.com/bugsnag/bugsnag-js/pull/1466)
- Avoid crash when `enabledBreadcrumbTypes` is `null` [#1467](https://github.com/bugsnag/bugsnag-js/pull/1467)
- (plugin-koa): Fix the Koa plugin suppressing other error handlers [#1482](https://github.com/bugsnag/bugsnag-js/pull/1482)

## 7.10.5 (2021-07-05)

### Fixed
Expand Down
8 changes: 5 additions & 3 deletions packages/core/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export default class ClientWithInternals<T extends Config = Config> extends Clie
_pausedSession: Session | null

_sessionDelegate: {
startSession: (client: ClientWithInternals, session: Session) => any
pauseSession: () => void
resumeSession: () => void
startSession: (client: ClientWithInternals, session: Session) => ClientWithInternals
pauseSession: (client: ClientWithInternals) => void
resumeSession: (client: ClientWithInternals) => ClientWithInternals
}

_addOnSessionPayload: (cb: (sessionPayload: Session) => void) => void
Expand All @@ -72,4 +72,6 @@ export default class ClientWithInternals<T extends Config = Config> extends Clie
}

_loadPlugin(plugin: Plugin): void

_isBreadcrumbTypeEnabled(type: string): boolean
}
8 changes: 7 additions & 1 deletion packages/core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ class Client {
}
}

_isBreadcrumbTypeEnabled (type) {
const types = this._config.enabledBreadcrumbTypes

return types === null || includes(types, type)
}

notify (maybeError, onError, cb = noop) {
const event = Event.create(maybeError, true, undefined, 'notify()', this._depth + 1, this._logger)
this._notify(event, onError, cb)
Expand Down Expand Up @@ -296,7 +302,7 @@ class Client {
return cb(null, event)
}

if (includes(this._config.enabledBreadcrumbTypes, 'error')) {
if (this._isBreadcrumbTypeEnabled('error')) {
// only leave a crumb for the error if actually got sent
Client.prototype.leaveBreadcrumb.call(this, event.errors[0].errorClass, {
errorClass: event.errors[0].errorClass,
Expand Down
93 changes: 73 additions & 20 deletions packages/core/test/client.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Client from '../client'
import Event from '../event'
import Session from '../session'
import breadcrumbTypes from '../lib/breadcrumb-types'
import { BreadcrumbType } from '../types/common'

const noop = () => {}
const id = <T>(a: T) => a

describe('@bugsnag/core/client', () => {
describe('constructor', () => {
Expand Down Expand Up @@ -396,6 +401,19 @@ describe('@bugsnag/core/client', () => {
expect(payloads[0].events[0].breadcrumbs.length).toBe(0)
})

it('leaves a breadcrumb of the error when enabledBreadcrumbTypes=null', () => {
const payloads: any[] = []
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: null })
client._setDelivery(client => ({ sendEvent: (payload) => payloads.push(payload), sendSession: () => {} }))
client.notify(new Error('foobar'))
expect(client._breadcrumbs).toHaveLength(1)
expect(client._breadcrumbs[0].type).toBe('error')
expect(client._breadcrumbs[0].message).toBe('Error')
expect(client._breadcrumbs[0].metadata.stacktrace).toBe(undefined)
// the error shouldn't appear as a breadcrumb for itself
expect(payloads[0].events[0].breadcrumbs).toHaveLength(0)
})

it('doesn’t modify global client.metadata when using addMetadata() method', () => {
const client = new Client({ apiKey: 'API_KEY_YEAH' })
client.addMetadata('foo', 'bar', [1, 2, 3])
Expand Down Expand Up @@ -614,20 +632,55 @@ describe('@bugsnag/core/client', () => {
})
})

describe('_isBreadcrumbTypeEnabled()', () => {
it.each(breadcrumbTypes)('returns true for "%s" when enabledBreadcrumbTypes is not configured', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH' })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(true)
})

it.each(breadcrumbTypes)('returns true for "%s" when enabledBreadcrumbTypes=null', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: null })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(true)
})

it.each(breadcrumbTypes)('returns false for "%s" when enabledBreadcrumbTypes=[]', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: [] })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(false)
})

it.each(breadcrumbTypes)('returns true for "%s" when enabledBreadcrumbTypes only contains it', (type) => {
const client = new Client({ apiKey: 'API_KEY_YEAH', enabledBreadcrumbTypes: [type as BreadcrumbType] })

expect(client._isBreadcrumbTypeEnabled(type)).toBe(true)
})

it.each(breadcrumbTypes)('returns false for "%s" when enabledBreadcrumbTypes does not contain it', (type) => {
const enabledBreadcrumbTypes = breadcrumbTypes.filter(enabledType => enabledType !== type)

const client = new Client({
apiKey: 'API_KEY_YEAH',
enabledBreadcrumbTypes: enabledBreadcrumbTypes as BreadcrumbType[]
})

expect(client._isBreadcrumbTypeEnabled(type)).toBe(false)
})
})

describe('startSession()', () => {
it('calls the provided session delegate and return delegate’s return value', () => {
const client = new Client({ apiKey: 'API_KEY' })
let ret
client._sessionDelegate = {
startSession: c => {
expect(c).toBe(client)
ret = {}
return ret
return c
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}
expect(client.startSession()).toBe(ret)
expect(client.startSession()).toBe(client)
})

it('tracks error counts using the session delegate and sends them in error payloads', (done) => {
Expand All @@ -638,8 +691,8 @@ describe('@bugsnag/core/client', () => {
client._session = new Session()
return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}
client._setDelivery(client => ({
sendSession: () => {},
Expand Down Expand Up @@ -668,9 +721,9 @@ describe('@bugsnag/core/client', () => {
it('does not start the session if onSession returns false', () => {
const client = new Client({ apiKey: 'API_KEY', onSession: () => false })
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
client._sessionDelegate = sessionDelegate

Expand All @@ -688,9 +741,9 @@ describe('@bugsnag/core/client', () => {
}
})
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
client._sessionDelegate = sessionDelegate

Expand All @@ -707,9 +760,9 @@ describe('@bugsnag/core/client', () => {
c._setDelivery(client => ({ sendEvent: (p, cb) => cb(null), sendSession: (s: any, cb: any) => cb(null) }))
c._logger = console
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
c._sessionDelegate = sessionDelegate
const eSpy = jest.fn()
Expand Down Expand Up @@ -787,9 +840,9 @@ describe('@bugsnag/core/client', () => {
it('forwards on calls to the session delegate', () => {
const client = new Client({ apiKey: 'API_KEY' })
const sessionDelegate = {
startSession: () => {},
pauseSession: () => {},
resumeSession: () => {}
startSession: id,
pauseSession: noop,
resumeSession: id
}
client._sessionDelegate = sessionDelegate

Expand Down
2 changes: 1 addition & 1 deletion packages/electron/src/client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = (opts) => {
bugsnag.markLaunchComplete = markLaunchComplete

bugsnag._logger.debug('Loaded! In main process.')
if (bugsnag._config.enabledBreadcrumbTypes && bugsnag._config.enabledBreadcrumbTypes.includes('state')) {
if (bugsnag._isBreadcrumbTypeEnabled('state')) {
bugsnag.leaveBreadcrumb('Bugsnag loaded', {}, 'state')
}

Expand Down
4 changes: 3 additions & 1 deletion packages/electron/src/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ module.exports = (rendererOpts) => {

// automatic error breadcrumbs will always be duplicates if created in renderers
// because both the renderers and main process create them for the same Event
opts.enabledBreadcrumbTypes = opts.enabledBreadcrumbTypes.filter(type => type !== 'error')
if (opts.enabledBreadcrumbTypes !== null) {
opts.enabledBreadcrumbTypes = opts.enabledBreadcrumbTypes.filter(type => type !== 'error')
}

const bugsnag = new Client(opts, schema, internalPlugins, require('../id'))

Expand Down
24 changes: 18 additions & 6 deletions packages/in-flight/test/in-flight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import BugsnagInFlightJustForTypescript from '../types/bugsnag-in-flight'

let bugsnagInFlight: BugsnagInFlightJustForTypescript
jest.isolateModules(() => { bugsnagInFlight = require('../src/in-flight') })
const noop = () => {}
const id = <T>(a: T) => a

describe('@bugsnag/in-flight', () => {
it('tracks in-flight events', () => {
Expand Down Expand Up @@ -50,6 +52,8 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession: jest.fn(function (client, session) {
client._delivery.sendSession(session, callback)

return client
}),
pauseSession: jest.fn(),
resumeSession: jest.fn()
Expand Down Expand Up @@ -89,6 +93,8 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession: jest.fn(function (client, session) {
client._delivery.sendSession(session, sessionCallback)

return client
}),
pauseSession: jest.fn(),
resumeSession: jest.fn()
Expand Down Expand Up @@ -135,9 +141,11 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession (client, session) {
client._delivery.sendSession(session, () => {})

return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}

client._setDelivery(() => ({
Expand Down Expand Up @@ -177,9 +185,11 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession: (client, session) => {
client._delivery.sendSession(session, () => {})

return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}

client._setDelivery(() => ({
Expand Down Expand Up @@ -225,9 +235,11 @@ describe('@bugsnag/in-flight', () => {
client._sessionDelegate = {
startSession (client, session) {
client._delivery.sendSession(session, () => {})

return client
},
pauseSession: () => {},
resumeSession: () => {}
pauseSession: noop,
resumeSession: id
}

client._setDelivery(() => ({
Expand Down
Loading

0 comments on commit aa298b7

Please sign in to comment.