Merge from master
This commit is contained in:
Коммит
2a75607027
|
@ -1,14 +1,68 @@
|
|||
import { IEnvelope } from '../coreSDK/JavaScriptSDK.Interfaces/Telemetry/IEnvelope';
|
||||
import { Data } from '../coreSDK/JavaScriptSDK/Telemetry/Common/Data';
|
||||
import { Envelope } from '../coreSDK/JavaScriptSDK/Telemetry/Common/Envelope';
|
||||
import { RemoteDependencyData } from '../coreSDK/JavaScriptSDK/Telemetry/RemoteDependencyData';
|
||||
import { Event } from '../coreSDK/JavaScriptSDK/Telemetry/Event';
|
||||
import { Exception } from '../coreSDK/JavaScriptSDK/Telemetry/Exception';
|
||||
import { Metric } from '../coreSDK/JavaScriptSDK/Telemetry/Metric';
|
||||
import { PageView } from '../coreSDK/JavaScriptSDK/Telemetry/PageView';
|
||||
import { PageViewPerformance } from '../coreSDK/JavaScriptSDK/Telemetry/PageViewPerformance';
|
||||
import { Trace } from '../coreSDK/JavaScriptSDK/Telemetry/Trace';
|
||||
import { ITelemetryItem } from '../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
///<reference path="./node_modules/applicationinsights-core-js/bundle/applicationinsights-core-js.d.ts" />
|
||||
import {
|
||||
IEnvelope, Data, Envelope,
|
||||
RemoteDependencyData, Event, Exception,
|
||||
Metric, PageView, Trace, PageViewPerformance
|
||||
} from 'applicationinsights-common';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export const ContextTagKeys: string[] = [
|
||||
"ai.application.ver",
|
||||
"ai.application.build",
|
||||
"ai.application.typeId",
|
||||
"ai.application.applicationId",
|
||||
"ai.application.layer",
|
||||
"ai.device.id",
|
||||
"ai.device.ip",
|
||||
"ai.device.language",
|
||||
"ai.device.locale",
|
||||
"ai.device.model",
|
||||
"ai.device.friendlyName",
|
||||
"ai.device.network",
|
||||
"ai.device.networkName",
|
||||
"ai.device.oemName",
|
||||
"ai.device.os",
|
||||
"ai.device.osVersion",
|
||||
"ai.device.roleInstance",
|
||||
"ai.device.roleName",
|
||||
"ai.device.screenResolution",
|
||||
"ai.device.type",
|
||||
"ai.device.machineName",
|
||||
"ai.device.vmName",
|
||||
"ai.device.browser",
|
||||
"ai.device.browserVersion",
|
||||
"ai.location.ip",
|
||||
"ai.location.country",
|
||||
"ai.location.province",
|
||||
"ai.location.city",
|
||||
"ai.operation.id",
|
||||
"ai.operation.name",
|
||||
"ai.operation.parentId",
|
||||
"ai.operation.rootId",
|
||||
"ai.operation.syntheticSource",
|
||||
"ai.operation.correlationVector",
|
||||
"ai.session.id",
|
||||
"ai.session.isFirst",
|
||||
"ai.session.isNew",
|
||||
"ai.user.accountAcquisitionDate",
|
||||
"ai.user.accountId",
|
||||
"ai.user.userAgent",
|
||||
"ai.user.id",
|
||||
"ai.user.storeRegion",
|
||||
"ai.user.authUserId",
|
||||
"ai.user.anonUserAcquisitionDate",
|
||||
"ai.user.authUserAcquisitionDate",
|
||||
"ai.cloud.name",
|
||||
"ai.cloud.role",
|
||||
"ai.cloud.roleVer",
|
||||
"ai.cloud.roleInstance",
|
||||
"ai.cloud.environment",
|
||||
"ai.cloud.location",
|
||||
"ai.cloud.deploymentUnit",
|
||||
"ai.internal.sdkVersion",
|
||||
"ai.internal.agentVersion",
|
||||
"ai.internal.nodeName",
|
||||
];
|
||||
|
||||
export abstract class EnvelopeCreator {
|
||||
abstract Create(telemetryItem: ITelemetryItem): IEnvelope;
|
||||
|
@ -31,7 +85,7 @@ export abstract class EnvelopeCreator {
|
|||
}
|
||||
|
||||
protected static createEnvelope<T>(envelopeType: string, telemetryItem: ITelemetryItem, data: Data<T>): IEnvelope {
|
||||
let envelope = new Envelope(data, Event.envelopeType);
|
||||
let envelope = new Envelope(data, envelopeType);
|
||||
envelope.iKey = telemetryItem.instrumentationKey;
|
||||
let iKeyNoDashes = telemetryItem.instrumentationKey.replace(/-/g, "");
|
||||
envelope.name = envelope.name.replace("{0}", iKeyNoDashes);
|
||||
|
@ -39,7 +93,7 @@ export abstract class EnvelopeCreator {
|
|||
// loop through the envelope systemProperties and pick out the ones that should go in tags
|
||||
for (let key in telemetryItem.sytemProperties) {
|
||||
if (telemetryItem.sytemProperties.hasOwnProperty(key)) {
|
||||
if (/*this key exists in the whitelist of ContextTagKeys*/ true) {// todo barustum
|
||||
if (ContextTagKeys.indexOf(key) >= 0) {
|
||||
envelope.tags[key] = telemetryItem.sytemProperties[key];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
///<reference path="./node_modules/applicationinsights-common/bundle/applicationinsights-common.d.ts" />
|
||||
///<reference path="./node_modules/applicationinsights-core-js/bundle/applicationinsights-core-js.d.ts" />
|
||||
import { ISenderConfig, XDomainRequest as IXDomainRequest, IBackendResponse } from './Interfaces';
|
||||
import { ISendBuffer, SessionStorageSendBuffer, ArraySendBuffer } from './SendBuffer';
|
||||
import {
|
||||
|
@ -13,31 +14,43 @@ import { MetricValidator } from './TelemetryValidation/MetricValidator';
|
|||
import { PageViewPerformanceValidator } from './TelemetryValidation/PageViewPerformanceValidator';
|
||||
import { PageViewValidator } from './TelemetryValidation/PageViewValidator';
|
||||
import { RemoteDepdencyValidator } from './TelemetryValidation/RemoteDepdencyValidator';
|
||||
import { ITelemetryPlugin } from '../coreSDK/JavaScriptSDK.Interfaces/ITelemetryPlugin';
|
||||
import { ITelemetryItem } from '../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { IEnvelope } from '../coreSDK/JavaScriptSDK.Interfaces/Telemetry/IEnvelope';
|
||||
import { PageView } from '../coreSDK/JavaScriptSDK/Telemetry/PageView';
|
||||
import { Event } from '../coreSDK/JavaScriptSDK/Telemetry/Event';
|
||||
import { Trace } from '../coreSDK/JavaScriptSDK/Telemetry/Trace';
|
||||
import { Exception } from '../coreSDK/JavaScriptSDK/Telemetry/Exception';
|
||||
import { Metric } from '../coreSDK/JavaScriptSDK/Telemetry/Metric';
|
||||
import { PageViewPerformance } from '../coreSDK/JavaScriptSDK/Telemetry/PageViewPerformance';
|
||||
import { RemoteDependencyData } from '../coreSDK/JavaScriptSDK/Telemetry/RemoteDependencyData';
|
||||
import { Serializer } from '../coreSDK/JavaScriptSDK/Serializer';
|
||||
import { IConfiguration } from '../coreSDK/JavaScriptSDK.Interfaces/IConfiguration';
|
||||
import { Serializer } from './Serializer'; // todo move to channel
|
||||
import {
|
||||
DisabledPropertyName, RequestHeaders, Util,
|
||||
_InternalMessageId, LoggingSeverity, _InternalLogging
|
||||
_InternalMessageId, LoggingSeverity, _InternalLogging,
|
||||
IEnvelope, PageView, Event,
|
||||
Trace, Exception, Metric,
|
||||
PageViewPerformance, RemoteDependencyData
|
||||
} from 'applicationinsights-common';
|
||||
import {
|
||||
IChannelControls, ITelemetryPlugin, ITelemetryItem, IConfiguration
|
||||
} from 'applicationinsights-core-js';
|
||||
|
||||
declare var XDomainRequest: {
|
||||
prototype: IXDomainRequest;
|
||||
new(): IXDomainRequest;
|
||||
};
|
||||
|
||||
export class Sender implements ITelemetryPlugin {
|
||||
priority: number; // todo set priority
|
||||
public identifier: string; // todo set identifier
|
||||
export class Sender implements IChannelControls {
|
||||
public priority: number; // todo set priority
|
||||
|
||||
public identifier: string;
|
||||
|
||||
public pause(): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
public resume(): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
public flush(): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
public teardown(): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
public setNextPlugin: (next: ITelemetryPlugin) => void;
|
||||
|
||||
|
@ -87,10 +100,11 @@ export class Sender implements ITelemetryPlugin {
|
|||
private _timeoutHandle: any;
|
||||
|
||||
public start(config: IConfiguration) {
|
||||
this.identifier = "AppInsightsChannelPlugin";
|
||||
this._consecutiveErrors = 0;
|
||||
this._retryAt = null;
|
||||
this._lastSend = 0;
|
||||
this._config = Sender._getDefaultAppInsightsChannelConfig(config);
|
||||
this._config = Sender._getDefaultAppInsightsChannelConfig(config, this.identifier);
|
||||
this._sender = null;
|
||||
this._buffer = (Util.canUseSessionStorage() && this._config.enableSessionStorageBuffer)
|
||||
? new SessionStorageSendBuffer(this._config) : new ArraySendBuffer(this._config);
|
||||
|
@ -332,9 +346,9 @@ export class Sender implements ITelemetryPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
private static _getDefaultAppInsightsChannelConfig(config: IConfiguration): ISenderConfig {
|
||||
private static _getDefaultAppInsightsChannelConfig(config: IConfiguration, identifier: string): ISenderConfig {
|
||||
let resultConfig = <ISenderConfig>{};
|
||||
let pluginConfig = config.extensions["AppInsightsChannelPlugin"];
|
||||
let pluginConfig = config.extensions[identifier];
|
||||
|
||||
// set default values
|
||||
resultConfig.endpointUrl = () => config.endpointUrl || "https://dc.services.visualstudio.com/v2/track";
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import { ISerializable } from '../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { LoggingSeverity, _InternalMessageId, _InternalLogging, Util } from 'applicationinsights-common';
|
||||
/**
|
||||
* Enum is used in aiDataContract to describe how fields are serialized.
|
||||
* For instance: (Fieldtype.Required | FieldType.Array) will mark the field as required and indicate it's an array
|
||||
*/
|
||||
export enum FieldType { Default = 0, Required = 1, Array = 2, Hidden = 4 };
|
||||
import { LoggingSeverity, _InternalMessageId, _InternalLogging, Util, ISerializable, FieldType } from 'applicationinsights-common';
|
||||
|
||||
export class Serializer {
|
||||
|
|
@ -1,10 +1,19 @@
|
|||
import { ITypeValidator } from './ITypeValidator';
|
||||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export class EventValidator implements ITypeValidator {
|
||||
static EventValidator = new EventValidator();
|
||||
|
||||
public Validate(event: ITelemetryItem): boolean {
|
||||
return false;// todo barustum
|
||||
public Validate(item: ITelemetryItem): boolean {
|
||||
// verify system properties has a ver field
|
||||
if (!item.sytemProperties || !item.sytemProperties["ver"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.domainProperties || !item.domainProperties["name"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,32 @@
|
|||
import { ITypeValidator } from './ITypeValidator';
|
||||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export class ExceptionValidator implements ITypeValidator {
|
||||
static ExceptionValidator = new ExceptionValidator();
|
||||
|
||||
Validate(event: ITelemetryItem): boolean {
|
||||
return false;
|
||||
Validate(item: ITelemetryItem): boolean {
|
||||
// verify system properties has a ver field
|
||||
if (!item.sytemProperties ||
|
||||
!item.sytemProperties["ver"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.domainProperties ||
|
||||
!item.domainProperties["exceptions"] ||
|
||||
!ExceptionValidator._validateExceptions(item.domainProperties["exceptions"])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO implement validation of exceptions
|
||||
private static _validateExceptions(exceptions: any[]): boolean {
|
||||
// typeName
|
||||
// message
|
||||
// parsedStack
|
||||
// stack
|
||||
// hasFullStack
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export interface ITypeValidator {
|
||||
Validate(event: ITelemetryItem): boolean;
|
||||
Validate(item: ITelemetryItem): boolean;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITypeValidator } from './ITypeValidator';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export class MetricValidator implements ITypeValidator {
|
||||
static MetricValidator = new MetricValidator();
|
||||
|
|
|
@ -1,10 +1,28 @@
|
|||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITypeValidator } from './ITypeValidator';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export class PageViewPerformanceValidator implements ITypeValidator {
|
||||
static PageViewPerformanceValidator = new PageViewPerformanceValidator();
|
||||
|
||||
Validate(event: ITelemetryItem): boolean {
|
||||
return false;
|
||||
public Validate(item: ITelemetryItem): boolean {
|
||||
// verify system properties has a ver field
|
||||
if (!item.sytemProperties ||
|
||||
!item.sytemProperties["ver"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.domainProperties ||
|
||||
!item.domainProperties["domProcessing"] ||
|
||||
!item.domainProperties["duration"] ||
|
||||
!item.domainProperties["name"] ||
|
||||
!item.domainProperties["networkConnect"] ||
|
||||
!item.domainProperties["perfTotal"] ||
|
||||
!item.domainProperties["receivedResponse"] ||
|
||||
!item.domainProperties["sentRequest"] ||
|
||||
!item.domainProperties["url"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,24 @@
|
|||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITypeValidator } from './ITypeValidator';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export class PageViewValidator implements ITypeValidator {
|
||||
static PageViewValidator = new PageViewValidator();
|
||||
|
||||
Validate(event: ITelemetryItem): boolean {
|
||||
return false;
|
||||
public Validate(item: ITelemetryItem): boolean {
|
||||
// verify system properties has a ver field
|
||||
if (!item.sytemProperties ||
|
||||
!item.sytemProperties["ver"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.domainProperties ||
|
||||
!item.domainProperties["id"] ||
|
||||
!item.domainProperties["name"] ||
|
||||
!item.domainProperties["duration"] ||
|
||||
!item.domainProperties["url"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,28 @@
|
|||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITypeValidator } from './ITypeValidator';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export class RemoteDepdencyValidator implements ITypeValidator {
|
||||
static RemoteDepdencyValidator = new RemoteDepdencyValidator();
|
||||
|
||||
Validate(event: ITelemetryItem): boolean {
|
||||
return false;
|
||||
public Validate(item: ITelemetryItem): boolean {
|
||||
// verify system properties has a ver field
|
||||
if (!item.sytemProperties ||
|
||||
!item.sytemProperties["ver"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.domainProperties ||
|
||||
!item.domainProperties["id"] ||
|
||||
!item.domainProperties["name"] ||
|
||||
!item.domainProperties["resultCode"] ||
|
||||
!item.domainProperties["duration"] ||
|
||||
!item.domainProperties["success"] ||
|
||||
!item.domainProperties["data"] ||
|
||||
!item.domainProperties["target"] ||
|
||||
!item.domainProperties["type"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,22 @@
|
|||
import { ITelemetryItem } from '../../coreSDK/JavaScriptSDK.Interfaces/ITelemetryItem';
|
||||
import { ITypeValidator } from './ITypeValidator';
|
||||
import { ITelemetryItem } from 'applicationinsights-core-js';
|
||||
|
||||
export class TraceValidator implements ITypeValidator {
|
||||
static TraceValidator = new TraceValidator();
|
||||
|
||||
Validate(event: ITelemetryItem): boolean {
|
||||
return false;
|
||||
public Validate(item: ITelemetryItem): boolean {
|
||||
// verify system properties has a ver field
|
||||
if (!item.sytemProperties ||
|
||||
!item.sytemProperties["ver"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.domainProperties ||
|
||||
!item.domainProperties["message"] ||
|
||||
!item.domainProperties["severityLevel"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# NPM Ignore
|
||||
|
||||
# ignore everything
|
||||
*
|
||||
|
||||
# ... but these files
|
||||
!package.json
|
||||
!bundle/aichannel.js
|
||||
!bundle/aichannel.js.map
|
||||
!bundle/aichannel.d.ts
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "applicationinsights-channel-js",
|
||||
"version": "0.0.1",
|
||||
"description": "Microsoft Application Insights JavaScript SDK Channel",
|
||||
"main": "bundle/aichannel.js",
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.1",
|
||||
"grunt-contrib-qunit": "2.0.0",
|
||||
"grunt-contrib-uglify": "3.1.0",
|
||||
"grunt-ts": "^6.0.0-beta.15",
|
||||
"typescript": "2.5.3"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# NPM Ignore
|
||||
|
||||
# ignore everything
|
||||
*
|
||||
|
||||
# ... but these files
|
||||
!package.json
|
||||
!bundle/**/*
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "applicationinsights-channel-js",
|
||||
"version": "0.0.1",
|
||||
"description": "Microsoft Application Insights JavaScript SDK Channel",
|
||||
"main": "bundle/aichannel.js",
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.1",
|
||||
"grunt-contrib-qunit": "2.0.0",
|
||||
"grunt-contrib-uglify": "3.1.0",
|
||||
"grunt-ts": "^6.0.0-beta.15",
|
||||
"typescript": "2.5.3"
|
||||
}
|
||||
}
|
|
@ -9,12 +9,7 @@
|
|||
"grunt-contrib-uglify": "3.1.0",
|
||||
"grunt-ts": "^6.0.0-beta.15",
|
||||
"typescript": "2.5.3",
|
||||
"applicationinsights-common": "file:../AppInsightsCommon/commonjs/applicationinsights-common-0.0.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"package.json",
|
||||
"bundle/**/*.js",
|
||||
"bundle/**/*.d.ts",
|
||||
"bundle/**/*.js.map"
|
||||
]
|
||||
"applicationinsights-common": "file:../AppInsightsCommon/cjs/applicationinsights-common-0.0.1.tgz",
|
||||
"applicationinsights-core-js": "file:../coreSDK/cjs/applicationinsights-core-js-0.0.1.tgz"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,3 +96,9 @@ export enum StorageType {
|
|||
LocalStorage,
|
||||
SessionStorage
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum is used in aiDataContract to describe how fields are serialized.
|
||||
* For instance: (Fieldtype.Required | FieldType.Array) will mark the field as required and indicate it's an array
|
||||
*/
|
||||
export enum FieldType { Default = 0, Required = 1, Array = 2, Hidden = 4 };
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { ISerializable } from '../../Interfaces/ISerializable';
|
||||
import { Base as AIBase } from '../../Interfaces/Contracts/Generated/Base'
|
||||
|
||||
|
||||
export class Base extends AIBase implements ISerializable {
|
||||
|
||||
/**
|
||||
* The data contract for serializing this object.
|
||||
*/
|
||||
public aiDataContract = {};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import { Data as AIData } from '../../../JavaScriptSDK.Interfaces/Contracts/Generated/Data';
|
||||
import { ISerializable } from '../../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { FieldType } from '../../../JavaScriptSDK/Serializer';
|
||||
import { Data as AIData } from '../../Interfaces/Contracts/Generated/Data';
|
||||
import { ISerializable } from '../../Interfaces/Telemetry/ISerializable';
|
||||
import { FieldType } from '../../Enums';
|
||||
|
||||
export class Data<TDomain> extends AIData<TDomain> implements ISerializable {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { DataPoint as AIDataPoint } from '../../../JavaScriptSDK.Interfaces/Contracts/Generated/DataPoint';
|
||||
import { ISerializable } from '../../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { FieldType } from '../../../JavaScriptSDK/Serializer';
|
||||
import { DataPoint as AIDataPoint } from '../../Interfaces/Contracts/Generated/DataPoint';
|
||||
import { ISerializable } from '../../Interfaces/Telemetry/ISerializable';
|
||||
import { FieldType } from '../../Enums';
|
||||
|
||||
export class DataPoint extends AIDataPoint implements ISerializable {
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
import { _InternalLogging, _InternalMessageId, LoggingSeverity, Util } from 'applicationinsights-common';
|
||||
import { _InternalLogging } from '../../Logging';
|
||||
import { Util } from '../../Util';
|
||||
import { LoggingSeverity, _InternalMessageId } from '../../Enums';
|
||||
|
||||
export class DataSanitizer {
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { Envelope as AIEnvelope } from '../../../JavaScriptSDK.Interfaces/Contracts/Generated/Envelope';
|
||||
import { Base } from '../../../JavaScriptSDK.Interfaces/Contracts/Generated/Base';
|
||||
import { IEnvelope } from '../../../JavaScriptSDK.Interfaces/Telemetry/IEnvelope';
|
||||
import { DataSanitizer } from '../../../JavaScriptSDK/Telemetry/Common/DataSanitizer';
|
||||
import { FieldType } from '../../../JavaScriptSDK/Serializer';
|
||||
import { Util } from 'applicationinsights-common';
|
||||
import { Envelope as AIEnvelope } from '../../Interfaces/Contracts/Generated/Envelope';
|
||||
import { Base } from '../../Interfaces/Contracts/Generated/Base';
|
||||
import { IEnvelope } from '../../Interfaces/Telemetry/IEnvelope';
|
||||
import { DataSanitizer } from './DataSanitizer';
|
||||
import { FieldType } from '../../Enums';
|
||||
import { Util } from '../../Util';
|
||||
|
||||
export class Envelope extends AIEnvelope implements IEnvelope {
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { EventData } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/EventData';
|
||||
import { ISerializable } from '../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { EventData } from '../Interfaces/Contracts/Generated/EventData';
|
||||
import { ISerializable } from '../Interfaces/Telemetry/ISerializable';
|
||||
import { DataSanitizer } from './Common/DataSanitizer';
|
||||
import { FieldType } from '../Serializer';
|
||||
import { Util } from 'applicationinsights-common';
|
||||
import { FieldType } from '../Enums';
|
||||
import { Util } from '../Util';
|
||||
|
||||
export class Event extends EventData implements ISerializable {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
import { StackFrame } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/StackFrame';
|
||||
import { ExceptionData } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/ExceptionData';
|
||||
import { ExceptionDetails } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/ExceptionDetails';
|
||||
import { ISerializable } from '../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { StackFrame } from '../Interfaces/Contracts/Generated/StackFrame';
|
||||
import { ExceptionData } from '../Interfaces/Contracts/Generated/ExceptionData';
|
||||
import { ExceptionDetails } from '../Interfaces/Contracts/Generated/ExceptionDetails';
|
||||
import { ISerializable } from '../Interfaces/Telemetry/ISerializable';
|
||||
import { DataSanitizer } from './Common/DataSanitizer';
|
||||
import { FieldType } from '../Serializer';
|
||||
import { SeverityLevel } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/SeverityLevel';
|
||||
import { Util } from 'applicationinsights-common';
|
||||
import { FieldType } from '../Enums';
|
||||
import { SeverityLevel } from '../Interfaces/Contracts/Generated/SeverityLevel';
|
||||
import { Util } from '../Util';
|
||||
|
||||
export class Exception extends ExceptionData implements ISerializable {
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { MetricData } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/MetricData';
|
||||
import { ISerializable } from '../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { MetricData } from '../Interfaces/Contracts/Generated/MetricData';
|
||||
import { ISerializable } from '../Interfaces/Telemetry/ISerializable';
|
||||
import { DataSanitizer } from './Common/DataSanitizer';
|
||||
import { FieldType } from '../Serializer';
|
||||
import { FieldType } from '../Enums';
|
||||
import { DataPoint } from './Common/DataPoint';
|
||||
import { SeverityLevel } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/SeverityLevel';
|
||||
import { Util } from 'applicationinsights-common';
|
||||
import { SeverityLevel } from '../Interfaces/Contracts/Generated/SeverityLevel';
|
||||
import { Util } from '../Util';
|
||||
|
||||
export class Metric extends MetricData implements ISerializable {
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import { PageViewData } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/PageViewData';
|
||||
import { PageViewData } from '../Interfaces/Contracts/Generated/PageViewData';
|
||||
import { DataSanitizer } from './Common/DataSanitizer';
|
||||
import { ISerializable } from '../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { FieldType } from '../Serializer';
|
||||
import { Util } from 'applicationinsights-common';
|
||||
import { ISerializable } from '../Interfaces/Telemetry/ISerializable';
|
||||
import { FieldType } from '../Enums';
|
||||
import { Util } from '../Util';
|
||||
|
||||
export class PageView extends PageViewData implements ISerializable {
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
import { PageViewPerfData } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/PageViewPerfData';
|
||||
import { FieldType } from '../Serializer';
|
||||
import { ISerializable } from '../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { PageViewPerfData } from '../Interfaces/Contracts/Generated/PageViewPerfData';
|
||||
import { FieldType, LoggingSeverity, _InternalMessageId } from '../Enums';
|
||||
import { ISerializable } from '../Interfaces/Telemetry/ISerializable';
|
||||
import { DataSanitizer } from './Common/DataSanitizer';
|
||||
import { Util, _InternalLogging, LoggingSeverity, _InternalMessageId } from 'applicationinsights-common';
|
||||
import { Util } from '../Util';
|
||||
import { _InternalLogging } from '../Logging';
|
||||
|
||||
|
||||
export class PageViewPerformance extends PageViewPerfData implements ISerializable {
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { DataSanitizer } from './Common/DataSanitizer';
|
||||
import { FieldType } from '../Serializer';
|
||||
import { ISerializable } from '../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { Util } from 'applicationinsights-common';
|
||||
import { AjaxHelper } from '../ajax/ajaxUtils';
|
||||
import { RemoteDependencyData as GeneratedRemoteDependencyData } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/RemoteDependencyData';
|
||||
import { FieldType } from '../Enums';
|
||||
import { ISerializable } from '../Interfaces/Telemetry/ISerializable';
|
||||
import { Util } from '../Util';
|
||||
import { AjaxHelper } from '../Util';
|
||||
import { RemoteDependencyData as GeneratedRemoteDependencyData } from '../Interfaces/Contracts/Generated/RemoteDependencyData';
|
||||
|
||||
export class RemoteDependencyData extends GeneratedRemoteDependencyData implements ISerializable {
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
import { MessageData } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/MessageData';
|
||||
import { ISerializable } from '../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
import { MessageData } from '../Interfaces/Contracts/Generated/MessageData';
|
||||
import { ISerializable } from '../Interfaces/Telemetry/ISerializable';
|
||||
import { DataSanitizer } from './Common/DataSanitizer';
|
||||
import { FieldType } from '../Serializer';
|
||||
import { SeverityLevel } from '../../JavaScriptSDK.Interfaces/Contracts/Generated/SeverityLevel';
|
||||
import { Util } from 'applicationinsights-common';
|
||||
import { FieldType } from '../Enums';
|
||||
import { SeverityLevel } from '../Interfaces/Contracts/Generated/SeverityLevel';
|
||||
import { Util } from '../Util';
|
||||
|
||||
export class Trace extends MessageData implements ISerializable {
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
import { _InternalLogging } from "./Logging";
|
||||
import { IConfig } from "./Interfaces/IConfig";
|
||||
import { RequestHeaders } from "./RequestResponseHeaders";
|
||||
import { DataSanitizer } from "./Telemetry/Common/DataSanitizer";
|
||||
|
||||
export class Util {
|
||||
private static document: any = typeof document !== "undefined" ? document : {};
|
||||
|
@ -645,4 +646,32 @@ export class CorrelationIdHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class AjaxHelper {
|
||||
public static ParseDependencyPath(absoluteUrl: string, method: string, pathName: string) {
|
||||
var target, name;
|
||||
if (absoluteUrl && absoluteUrl.length > 0) {
|
||||
var parsedUrl: HTMLAnchorElement = UrlHelper.parseUrl(absoluteUrl)
|
||||
target = parsedUrl.host;
|
||||
if (parsedUrl.pathname != null) {
|
||||
var pathName: string = (parsedUrl.pathname.length === 0) ? "/" : parsedUrl.pathname;
|
||||
if (pathName.charAt(0) !== '/') {
|
||||
pathName = "/" + pathName;
|
||||
}
|
||||
|
||||
name = DataSanitizer.sanitizeString(method ? method + " " + pathName : pathName);
|
||||
} else {
|
||||
name = DataSanitizer.sanitizeString(absoluteUrl);
|
||||
}
|
||||
} else {
|
||||
target = pathName;
|
||||
name = pathName;
|
||||
}
|
||||
|
||||
return {
|
||||
target: target,
|
||||
name: name
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# NPM Ignore
|
||||
|
||||
# ignore everything
|
||||
*
|
||||
|
||||
# ... but these files
|
||||
!package.json
|
||||
!bundle/applicationinsights-common.js
|
||||
!bundle/applicationinsights-common.js.map
|
||||
!bundle/applicationinsights-common.d.ts
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "applicationinsights-common",
|
||||
"version": "0.0.1",
|
||||
"description": "Microsoft Application Insights Common JavaScript Library",
|
||||
"main": "bundle/applicationinsights-common.js",
|
||||
"types": "bundle/applicationinsights-common.d.ts",
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.1",
|
||||
"grunt-contrib-qunit": "2.0.0",
|
||||
"grunt-contrib-uglify": "3.1.0",
|
||||
"grunt-ts": "^6.0.0-beta.15",
|
||||
"typescript": "2.5.3"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
export { Util, CorrelationIdHelper, UrlHelper } from './Util';
|
||||
export { _InternalMessageId, LoggingSeverity, FieldType } from './Enums';
|
||||
export { IConfig } from './Interfaces/IConfig';
|
||||
export { _InternalLogging, _InternalLogMessage } from './Logging';
|
||||
export { RequestHeaders } from './RequestResponseHeaders';
|
||||
export { DisabledPropertyName } from './Constants';
|
||||
export { Data as AIData } from './Interfaces/Contracts/Generated/Data';
|
||||
export { Base as AIBase } from './Interfaces/Contracts/Generated/Base';
|
||||
export { ISerializable } from './Interfaces/Telemetry/ISerializable';
|
||||
export { IEnvelope } from './Interfaces/Telemetry/IEnvelope';
|
||||
export { Envelope } from './Telemetry/Common/Envelope';
|
||||
export { Event } from './Telemetry/Event';
|
||||
export { Exception } from './Telemetry/Exception';
|
||||
export { Metric } from './Telemetry/Metric';
|
||||
export { PageView } from './Telemetry/PageView';
|
||||
export { RemoteDependencyData } from './Telemetry/RemoteDependencyData';
|
||||
export { Trace } from './Telemetry/Trace';
|
||||
export { PageViewPerformance } from './Telemetry/PageViewPerformance';
|
||||
export { Data } from './Telemetry/Common/Data';
|
|
@ -0,0 +1,8 @@
|
|||
# NPM Ignore
|
||||
|
||||
# ignore everything
|
||||
*
|
||||
|
||||
# ... but these files
|
||||
!package.json
|
||||
!bundle/**/*
|
|
@ -2,19 +2,13 @@
|
|||
"name": "applicationinsights-common",
|
||||
"version": "0.0.1",
|
||||
"description": "Microsoft Application Insights Common JavaScript Library",
|
||||
"main":"./bundle/applicationinsights-common.js",
|
||||
"types":"./bundle/applicationinsights-common.d.ts",
|
||||
"main": "bundle/applicationinsights-common.js",
|
||||
"types": "bundle/applicationinsights-common.d.ts",
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.1",
|
||||
"grunt-contrib-qunit": "2.0.0",
|
||||
"grunt-contrib-uglify": "3.1.0",
|
||||
"grunt-ts": "^6.0.0-beta.15",
|
||||
"typescript": "2.5.3"
|
||||
},
|
||||
"files": [
|
||||
"package.json",
|
||||
"bundle/**/*.js",
|
||||
"bundle/**/*.d.ts",
|
||||
"bundle/**/*.js.map"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
"alwaysStrict": true,
|
||||
"declaration": true,
|
||||
"outDir": "./bundle",
|
||||
"rootDir": "./"
|
||||
"rootDir": "./AppInsightsCommon"
|
||||
},
|
||||
"files": []
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
"name": "applicationinsights-common",
|
||||
"version": "0.0.1",
|
||||
"description": "Microsoft Application Insights Common JavaScript Library",
|
||||
"main": "./bundle/applicationinsights-common.js",
|
||||
"types": "./bundle/applicationinsights-common.d.ts",
|
||||
"main": "bundle/applicationinsights-common.js",
|
||||
"types": "bundle/applicationinsights-common.d.ts",
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.1",
|
||||
"grunt-contrib-qunit": "2.0.0",
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
export { Util, CorrelationIdHelper, UrlHelper } from './AppInsightsCommon/Util';
|
||||
export { _InternalMessageId, LoggingSeverity } from './AppInsightsCommon/Enums';
|
||||
export { IConfig } from './AppInsightsCommon/Interfaces/IConfig';
|
||||
export { _InternalLogging, _InternalLogMessage } from './AppInsightsCommon/Logging';
|
||||
export { RequestHeaders } from './AppInsightsCommon/RequestResponseHeaders';
|
||||
export { DisabledPropertyName } from './AppInsightsCommon/Constants';
|
|
@ -1,10 +0,0 @@
|
|||
import { Base as AIBase } from '../../../JavaScriptSDK.Interfaces/Contracts/Generated/Base';
|
||||
import { ISerializable } from '../../../JavaScriptSDK.Interfaces/Telemetry/ISerializable';
|
||||
|
||||
export class Base extends AIBase implements ISerializable {
|
||||
|
||||
/**
|
||||
* The data contract for serializing this object.
|
||||
*/
|
||||
public aiDataContract = {};
|
||||
}
|
|
@ -86,32 +86,4 @@ export class EventHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class AjaxHelper {
|
||||
public static ParseDependencyPath(absoluteUrl: string, method: string, pathName: string) {
|
||||
var target, name;
|
||||
if (absoluteUrl && absoluteUrl.length > 0) {
|
||||
var parsedUrl: HTMLAnchorElement = UrlHelper.parseUrl(absoluteUrl)
|
||||
target = parsedUrl.host;
|
||||
if (parsedUrl.pathname != null) {
|
||||
var pathName: string = (parsedUrl.pathname.length === 0) ? "/" : parsedUrl.pathname;
|
||||
if (pathName.charAt(0) !== '/') {
|
||||
pathName = "/" + pathName;
|
||||
}
|
||||
|
||||
name = DataSanitizer.sanitizeString(method ? method + " " + pathName : pathName);
|
||||
} else {
|
||||
name = DataSanitizer.sanitizeString(absoluteUrl);
|
||||
}
|
||||
} else {
|
||||
target = pathName;
|
||||
name = pathName;
|
||||
}
|
||||
|
||||
return {
|
||||
target: target,
|
||||
name: name
|
||||
};
|
||||
}
|
||||
}
|
|
@ -5,6 +5,6 @@
|
|||
|
||||
# ... but these files
|
||||
!package.json
|
||||
!bundle/aicore.js
|
||||
!bundle/aicore.js.map
|
||||
!bundle/aicore.d.ts
|
||||
!bundle/applicationinsights-core-js.js
|
||||
!bundle/applicationinsights-core-js.js.map
|
||||
!bundle/applicationinsights-core-js.d.ts
|
|
@ -2,8 +2,8 @@
|
|||
"name": "applicationinsights-core-js",
|
||||
"version": "0.0.7",
|
||||
"description": "Microsoft Application Insights Core Javascript SDK",
|
||||
"main": "bundle/aicore.js",
|
||||
"types": "bundle/aicore.d.ts",
|
||||
"main": "bundle/applicationinsights-core-js.js",
|
||||
"types": "bundle/applicationinsights-core-js.d.ts",
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.1",
|
||||
"grunt-contrib-qunit": "2.0.0",
|
||||
|
|
21
gruntfile.js
21
gruntfile.js
|
@ -24,21 +24,21 @@ module.exports = function (grunt) {
|
|||
'coreSDK/JavaScriptSDK/AppInsightsCore.ts',
|
||||
'coreSDK/applicationinsights-core-js.ts'
|
||||
],
|
||||
out: 'coreSDK/amd/bundle/aicore.js',
|
||||
out: 'coreSDK/amd/bundle/applicationinsights-core-js.js',
|
||||
},
|
||||
common: {
|
||||
tsconfig: './tsconfig.json',
|
||||
src: [
|
||||
'applicationinsights-common.ts',
|
||||
'AppInsightsCommon/applicationinsights-common.ts',
|
||||
'AppInsightsCommon/*.ts',
|
||||
'AppInsightsCommon/Interfaces/*.ts'
|
||||
],
|
||||
out: 'AppInsightsCommon/bundle/applicationinsights-common.js'
|
||||
out: 'AppInsightsCommon/amd/bundle/applicationinsights-common.js'
|
||||
},
|
||||
commoncjs: {
|
||||
tsconfig: './AppInsightsCommon/commonjs/tsconfigcommonjs.json',
|
||||
tsconfig: './AppInsightsCommon/cjs/tsconfigcommonjs.json',
|
||||
src: [
|
||||
'applicationinsights-common.ts',
|
||||
'AppInsightsCommon/applicationinsights-common.ts',
|
||||
'AppInsightsCommon/*.ts',
|
||||
'AppInsightsCommon/Interfaces/*.ts'
|
||||
]
|
||||
|
@ -49,7 +49,14 @@ module.exports = function (grunt) {
|
|||
'AppInsightsChannel/*.ts',
|
||||
'AppInsightsChannel/TelemetryValidation/*.ts'
|
||||
],
|
||||
out: 'AppInsightsChannel/bundle/aichannel.js'
|
||||
out: 'AppInsightsChannel/amd/bundle/aichannel.js'
|
||||
},
|
||||
channelcjs: {
|
||||
tsconfig:'./AppInsightsChannel/cjs/tsconfigcommonjs.json',
|
||||
src: [
|
||||
'AppInsightsChannel/*.ts',
|
||||
'AppInsightsChannel/TelemetryValidation/*.ts'
|
||||
]
|
||||
},
|
||||
corecjs: {
|
||||
tsconfig: './coreSDK/cjs/tsconfigcommonjs.json',
|
||||
|
@ -208,7 +215,7 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask("common", ["ts:common"]);
|
||||
grunt.registerTask("commoncjs", ["ts:commoncjs"]);
|
||||
grunt.registerTask("channel", ["ts:channel"]);
|
||||
grunt.registerTask("channelcommonjs", ["ts:channelcommonjs"]);
|
||||
grunt.registerTask("channelcjs", ["ts:channelcjs"]);
|
||||
grunt.registerTask("module", ["ts:module"]);
|
||||
grunt.registerTask("coretest", ["ts:core", "ts:coretest", "qunit:core"]);
|
||||
grunt.registerTask("test", ["ts:default", "ts:test", "ts:testSchema", "ts:testE2E", "ts:types", "qunit"]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче