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

add fetch vs ajax to existing field 'type', use 'name' as path name #760

Merged
merged 2 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions AppInsightsCommon/src/Telemetry/RemoteDependencyData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class RemoteDependencyData extends GeneratedRemoteDependencyData implemen
/**
* Constructs a new instance of the RemoteDependencyData object
*/
constructor(logger: IDiagnosticLogger, id: string, absoluteUrl: string, commandName: string, value: number, success: boolean, resultCode: number, method?: string, properties?: Object, measurements?: Object) {
constructor(logger: IDiagnosticLogger, id: string, absoluteUrl: string, commandName: string, value: number, success: boolean, resultCode: number, method?: string, requestAPI: string = "Ajax", properties?: Object, measurements?: Object) {
super();

this.id = id;
Expand All @@ -51,7 +51,7 @@ export class RemoteDependencyData extends GeneratedRemoteDependencyData implemen
this.success = success;
this.resultCode = resultCode + "";

this.type = "Ajax";
this.type = DataSanitizer.sanitizeString(logger, requestAPI);
this.data = DataSanitizer.sanitizeUrl(logger, commandName);

var dependencyFields = AjaxHelper.ParseDependencyPath(logger, absoluteUrl, method, commandName);
Expand Down
9 changes: 6 additions & 3 deletions extensions/applicationinsights-dependencies-js/src/ajax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ export class AjaxMonitor implements ITelemetryPlugin, IDependenciesPlugin, IInst
var dependency = <IDependencyTelemetry>{
id: xhr.ajaxData.id,
target: xhr.ajaxData.getAbsoluteUrl(),
type: xhr.ajaxData.getPathName(),
name: xhr.ajaxData.getPathName(),
type: "Ajax",
duration: xhr.ajaxData.ajaxTotalDuration,
success:(+(xhr.ajaxData.status)) >= 200 && (+(xhr.ajaxData.status)) < 400,
responseCode: +xhr.ajaxData.status,
Expand Down Expand Up @@ -490,7 +491,8 @@ export class AjaxMonitor implements ITelemetryPlugin, IDependenciesPlugin, IInst
let dependency: IDependencyTelemetry = {
id: ajaxData.id,
target: ajaxData.getAbsoluteUrl(),
type: ajaxData.getPathName(),
name: ajaxData.getPathName(),
type: "Fetch",
duration: ajaxData.ajaxTotalDuration,
success: response.status >= 200 && response.status < 400,
responseCode: response.status,
Expand Down Expand Up @@ -540,7 +542,8 @@ export class AjaxMonitor implements ITelemetryPlugin, IDependenciesPlugin, IInst
let dependency: IDependencyTelemetry = {
id: ajaxData.id,
target: ajaxData.getAbsoluteUrl(),
type: ajaxData.getPathName(),
name: ajaxData.getPathName(),
type: "Fetch",
duration: ajaxData.ajaxTotalDuration,
success: false,
responseCode: 0,
Expand Down