-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: check-ins configuration api #1241
Conversation
I moved the last 3 TODO points to #1243 because this PR is already too big and a review will be difficult. |
@@ -290,7 +289,7 @@ export function sanitize(obj, maxDepth = 8) { | |||
return safeSerialize(obj) | |||
} | |||
|
|||
export function logger(client: Client): Logger { | |||
export function logger(client: { config: { debug: boolean; logger: Logger; } }): Logger { |
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.
Support more than one client (CheckinsClient
and HoneybadgerClient
)
defaultHeaders(): Record<string, string> { | ||
return {}; | ||
} | ||
send<T>(_options: TransportOptions, _payload: T): Promise<{ statusCode: number; body: string }> { |
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.
Made the payload
to be generic because I didn't want to define the payload for check-ins here (check-ins are not part of the core
package)
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.
Project that demonstrates npx honeybadger-checkins-sync
.
@@ -127,6 +164,7 @@ const singleton = new Honeybadger({ | |||
uncaughtException(), | |||
unhandledRejection() | |||
], | |||
...(readConfigFromFileSystem() ?? {}) |
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.
This line allows loading configuration from a file.
'util', | ||
'domain', | ||
'async_hooks', | ||
'cosmiconfig', |
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 not entirely sure about this.
My reasoning is:
- this is the server bundle, we want to transform to multiple targets (formats),
- but it can require external modules (i.e. from node_modules)
However, we want the browser bundles to be single files so they can be loaded from the CDN.
This reverts commit 4073ae4.
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.
LGTM
Status
READY
Description
Check-Ins configuration through the SDK, similar to the Laravel/PHP implementation.
Closes #1208.
Related PRs
Todos
Honeybadger.checkin(checkinName)
<- should not throw errorsBonus:
honeybadger.config.js
(only for js on the server) - adds dependency to cosmicconfigTests for reading config from fileTests for configuration precedence: config file, constructor parameters, default valuesDocumentation for configuration file - #375