Skip to content
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

Only report extension load errors on start #1051

Merged
merged 1 commit into from
May 10, 2024

Conversation

unflxw
Copy link
Contributor

@unflxw unflxw commented May 7, 2024

Before this change, extension load errors would be reported whenever
@appsignal/nodejs or the client.ts file was imported. Now they
will only be reported whenever Client fails to initialise.

This fixes an issue where the extension load errors would be reported
when running npm install in the appsignal-nodejs folder.

Rearrange the way that the client is initialised. Remove the
client.start() method, as starting is done automatically during
initialisation. Use early returns to clearly distinguish the client
initialisation failure scenarios. Emit distinct error messages for
different configuration-related failures.

Change the Client.isActive method to reflect whether the client
was actually initialised, rather than whether several factors in
the configuration should mean that the client was initialised.

This is an improvement to #960, as AppSignal will no longer show an error about the extension not loading when active is set to false. It would still be nice to have a dedicated, non-scary Windows error.

@unflxw unflxw self-assigned this May 7, 2024
@unflxw unflxw marked this pull request as draft May 7, 2024 20:59
@unflxw unflxw requested a review from luismiramirez May 8, 2024 08:32
@tombruijn
Copy link
Member

I'm okay with this change but you need to update the tests for this.

@unflxw
Copy link
Contributor Author

unflxw commented May 8, 2024

@tombruijn Yeah, the tests are correct to be failing -- now the message is not emitted at all. I'll see what I can do to fix it.

@unflxw unflxw force-pushed the only-report-extension-load-errors-on-start branch 2 times, most recently from 2c0b1ce to b297d9a Compare May 8, 2024 13:42
@unflxw unflxw marked this pull request as ready for review May 8, 2024 13:42
@backlog-helper
Copy link

backlog-helper bot commented May 8, 2024

✔️ All good!

New issue guide | Backlog management | Rules | Feedback

@unflxw
Copy link
Contributor Author

unflxw commented May 8, 2024

@tombruijn It's been fixed now -- but I've also changed a lot of other stuff in the process. I couldn't understand what the right place to emit these warnings in the client initialisation was, so I ended up rearranging it significantly to figure it out.

@backlog-helper
Copy link


This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

@tombruijn
Copy link
Member

Worth it to add a changeset .

Before this change, extension load errors would be reported whenever
`@appsignal/nodejs` or the `client.ts` file was imported. Now they
will only be reported whenever `Client` fails to initialise.

This fixes an issue where the extension load errors would be reported
when running `npm install` in the `appsignal-nodejs` folder.

Rearrange the way that the client is initialised. Remove the
`client.start()` method, as starting is done automatically during
initialisation. Use early returns to clearly distinguish the client
initialisation failure scenarios. Emit distinct error messages for
different configuration-related failures.

Change the `this.#isActive` method to reflect whether the client
was actually initialised, rather than whether several factors in
the configuration should mean that the client was initialised.
@unflxw unflxw force-pushed the only-report-extension-load-errors-on-start branch from b297d9a to 6bf596c Compare May 10, 2024 15:10
@unflxw unflxw merged commit f9bc061 into main May 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants