-
Notifications
You must be signed in to change notification settings - Fork 240
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
include response error data #1161
Conversation
…espond code is not 200
@@ -557,6 +559,11 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu | |||
} | |||
} | |||
|
|||
if (_self._config.includeResponseErrorData && xhr.status !== 200) { |
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.
_self._config.includeResponseErrorData && xhr.status !== 200 [](start = 16, length = 60)
Do we want to do this for all !=200 status codes or should we just check >=400 ?
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.
+1 we should only do this for status >= 400
As any response from 200 -> 299 is considered to be a success response, a common response is 204 == No Content.
And 300-> 399 are redirects
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.
@@ -557,6 +559,11 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu | |||
} | |||
} | |||
|
|||
if (_self._config.includeResponseErrorData && xhr.status !== 200) { |
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.
+1 we should only do this for status >= 400
As any response from 200 -> 299 is considered to be a success response, a common response is 204 == No Content.
And 300-> 399 are redirects
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.
Also add config option to README
@@ -557,6 +559,11 @@ export class AjaxMonitor extends BaseTelemetryPlugin implements IDependenciesPlu | |||
} | |||
} | |||
|
|||
if (_self._config.includeResponseErrorData && xhr.status !== 200) { | |||
dependency.properties = dependency.properties || {}; | |||
dependency.properties.responseError = xhr.statusText + " - " + xhr.responseText; |
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.
nit: rename to responseMessage
or responseText
, to convey string type instead of Error.
@@ -61,6 +61,7 @@ export class ApplicationInsightsTests extends TestClass { | |||
disableFetchTracking: false, | |||
enableRequestHeaderTracking: true, | |||
enableResponseHeaderTracking: true, | |||
includeResponseErrorData: true, |
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 this should be renamed to disableAjaxErrorStatusText
since it seems like something we would want to enable by default.
@@ -294,6 +294,14 @@ export interface IConfig { | |||
*/ | |||
enableResponseHeaderTracking?: boolean; | |||
|
|||
/** | |||
* @description An optional value that will track Resonse Error data through trackDependency function. |
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.
Small typo in description Resonse
Include response error data in part C on dependency event when ajax respond code is not 200.
Closes: #1156