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

Question: Where does the id show up? #2225

Closed
cbtgit opened this issue Dec 14, 2023 · 3 comments
Closed

Question: Where does the id show up? #2225

cbtgit opened this issue Dec 14, 2023 · 3 comments
Assignees
Milestone

Comments

@cbtgit
Copy link

cbtgit commented Dec 14, 2023

Where in the App. insights interface can i see/search for the id that can be supplied for the IExceptionTelemetry interface?

export declare interface IExceptionTelemetry extends IPartC { /** * Unique guid identifying this error */ id?: string; /** * @deprecated * @type {Error} * @memberof IExceptionTelemetry * @description DEPRECATED: Please use exception instead. Behavior/usage for exception remains the same as this field. */ error?: Error; /** * @type {Error} * @memberof IExceptionTelemetry * @description Error Object(s) */ exception?: Error | IAutoExceptionTelemetry; /** * @description Specified severity of exception for use with * telemetry filtering in dashboard * @type {(SeverityLevel | number)} * @memberof IExceptionTelemetry */ severityLevel?: SeverityLevel | number; }

@MSNev
Copy link
Collaborator

MSNev commented Dec 14, 2023

By Default the automatic captured errors don't populate the id, you can however call the trackException() yourself and as part of the IExceptionTelemetry object you pass in you can specify the id yourself.

We treat any passed instance as a simple object and not some type of class.
Here is the code we use to "construct" the automatic error isntances (effectively from the window.onerror)

public static CreateAutoException(
message: string | Event,
url: string,
lineNumber: number,
columnNumber: number,
error: any,
evt?: Event|string,
stack?: string,
errorSrc?: string
): IAutoExceptionTelemetry {
let errorType = _getErrorType(error || evt || message);
return {
message: _formatMessage(message, errorType),
url,
lineNumber,
columnNumber,
error: _formatErrorCode(error || evt || message),
evt: _formatErrorCode(evt || message),
typeName: errorType,
stackDetails: _getStackFromErrorObj(stack || error || evt),
errorSrc
}
}

@cbtgit
Copy link
Author

cbtgit commented Dec 15, 2023

@MSNev Thank you for your reply. I am calling trackException myself and passing in, an id generated with the uuid npm package. If i go to Logs and exceptions in the App. insights UI, I can't seem to find a column containing my id - there is a itemId column, with a diff. id, but no column with my generated id?

@siyuniu-ms
Copy link
Contributor

siyuniu-ms commented Jan 30, 2024

hi @cbtgit sorry for the late response.
Here is my local test result:

  1.  appInsights.trackException({id:"siyuTest1", error: new Error("test local exception"), severityLevel: 3});
    

this one would not show id in azure portal

  1. appInsights.trackException({id:"siyuTest2",  severityLevel: 3});
    

and this one would pass the id to the azure portal
image
Seems like in the option 1, the error message overwrite the id. Will continue investigate...

@siyuniu-ms siyuniu-ms added bug and removed question labels Jan 30, 2024
@MSNev MSNev added this to the 3.1.x milestone Feb 5, 2024
@siyuniu-ms siyuniu-ms added the fixed - waiting release PR Committed and waiting deployment label Feb 7, 2024
@MSNev MSNev added waiting - CDN deployment released - NPM and removed fixed - waiting release PR Committed and waiting deployment labels Feb 15, 2024
@MSNev MSNev closed this as completed Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants