-
Notifications
You must be signed in to change notification settings - Fork 42
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
CatchAll method + test on transport #3
Conversation
return this.transport.send(err) | ||
} | ||
|
||
return null | ||
} | ||
|
||
catchAll (opts?: any): Boolean | void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure that's now enabled by default, we should automatically call it inside the init
of the feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/native.ts
Outdated
@@ -0,0 +1,5 @@ | |||
interface Error { | |||
prepareStackTrace?: () => void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the typings of node are available with @types/node
src/features/notify.ts
Outdated
} | ||
|
||
if (listener === 'unhandledRejection') { | ||
error = 'You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:\n' + error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm pretty sure we do not need to modify the error, maybe just add a console.error
to indicate that the error come from an unhandledRejection
should be enough ?
src/utils/error-callsites.ts
Outdated
export default class ErrorCallSites { | ||
|
||
static init () { | ||
const orig = Error.prepareStackTrace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should remove this, it has been tested but we saw a lot of performances issues in the past, specially with bluebird that create a lot of error just to keep track of the stack when using polyfill for promise.
@@ -4,7 +4,7 @@ import * as stringify from 'json-stringify-safe' | |||
debug('axm:transport') | |||
|
|||
export default class Transport { | |||
send (args: Error, print: Boolean): void { | |||
send (args: Error | any, print?: Boolean): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe transport should in the manager
folder since it need to be started before each feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/features/notify.ts
Outdated
return this.transport.send(err) | ||
} | ||
|
||
return null | ||
} | ||
|
||
catchAll (opts?: any): Boolean | void { | ||
Callsites.init() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cf message in the callsite file
A little fix should be to check that the error that is received by |
src/features/probe.ts
Outdated
import { Feature } from './featureTypes' | ||
import Meter from '../probes/meter' | ||
|
||
export default class ProbeFeature implements Feature { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we don't want to name it Probe
, that was the old name, it's way easier to our customer to understand metrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/features/probe.ts
Outdated
@@ -0,0 +1,17 @@ | |||
import { Feature } from './featureTypes' | |||
import Meter from '../probes/meter' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to use a 3rd party package to handle the actual compute, to discuss
No description provided.