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

Any way for extension to properly report exceptions #217

Open
kmagiera opened this issue Nov 20, 2024 · 1 comment
Open

Any way for extension to properly report exceptions #217

kmagiera opened this issue Nov 20, 2024 · 1 comment

Comments

@kmagiera
Copy link
Contributor

Thanks for maintaining this package!

Wanted to ask if there's any way for extension to report exceptions in a way that they can be recognized as errors by the Application Insights.

Currently, all errors are reported as events with unhandlederror name. This makes them impossible to properly aggregate and identify issues as they fall under a single category and the important details like stack traces can be extracted for individual records only making it difficult to see what type of errors occur at what frequency.

In ApplicationInsights-JS package, there's a trackException method which seem to work ok. However, using that package in my vscode extension seem very unstable as I get a tons of errors about retries and other stuff. I dig a bit into the source code of that package, and tried to replicate its behavior when sending exceptions, specifically in appInsightsClientFactory I tried to add logException method that'd construct an event that would match what the JS module seem to generate:

appInsightsClient?.track({
    name: "Exception",
    baseType: "ExceptionData",
    baseData: {
      severityLevel: "Error",
      exceptions: [
        {
          message: "Error Message",
          typeName: "SomeErrorType",
          parsedStack: [],
          hasFullStack: true,
        },
      ],
    },
  });

With this approach, errors are now recognized and reported under "Failure" in Application Insights, however, they still don't have the correct shape and the data seem to just be serialized to JSON and put as description while stack trace doesn't get extracted properly:
Image

I was wondering if there's a better way this can be done such that we can rely on Application Insights in our extension for error tracking,

@lramos15
Copy link
Member

You can query app insights for the unhandled errors but I know it's not as nice as this exception UI. A lot of the reason we do error reporting in a non-standard way is so that we may clean the error stack of any possible PII such as usernames as to not identify any of the users. I'm not familiar with how to change things such that this view is populated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants