@microsoft/applicationinsights-common 2.8.0-beta.2203-15 → 2.8.0-nightly.2204-04
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-common.integrity.json +9 -9
- package/browser/applicationinsights-common.js +157 -295
- package/browser/applicationinsights-common.js.map +1 -1
- package/browser/applicationinsights-common.min.js +2 -2
- package/browser/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.api.json +2805 -1244
- package/dist/applicationinsights-common.api.md +78 -35
- package/dist/applicationinsights-common.d.ts +494 -282
- package/dist/applicationinsights-common.js +157 -295
- package/dist/applicationinsights-common.js.map +1 -1
- package/dist/applicationinsights-common.min.js +2 -2
- package/dist/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.rollup.d.ts +494 -282
- package/dist-esm/ConnectionStringParser.js +1 -1
- package/dist-esm/Constants.js +1 -1
- package/dist-esm/DomHelperFuncs.js +1 -1
- package/dist-esm/Enums.js +1 -1
- package/dist-esm/HelperFuncs.js +1 -1
- package/dist-esm/Interfaces/ConnectionString.js +1 -1
- package/dist-esm/Interfaces/Context/IApplication.js +1 -1
- package/dist-esm/Interfaces/Context/IDevice.js +1 -1
- package/dist-esm/Interfaces/Context/IInternal.js +1 -1
- package/dist-esm/Interfaces/Context/ILocation.js +1 -1
- package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
- package/dist-esm/Interfaces/Context/ISample.js +1 -1
- package/dist-esm/Interfaces/Context/ISession.js +1 -1
- package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
- package/dist-esm/Interfaces/Context/IUser.js +1 -1
- package/dist-esm/Interfaces/Context/IWeb.js +1 -1
- package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
- package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
- package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
- package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
- package/dist-esm/Interfaces/Contracts/IData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
- package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
- package/dist-esm/Interfaces/Contracts/SeverityLevel.js +1 -1
- package/dist-esm/Interfaces/IAppInsights.js +1 -1
- package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
- package/dist-esm/Interfaces/IConfig.js +1 -1
- package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
- package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
- package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
- package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
- package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPartC.js +1 -1
- package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
- package/dist-esm/Interfaces/IRequestContext.js +1 -1
- package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
- package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
- package/dist-esm/Interfaces/PartAExtensions.js +2 -2
- package/dist-esm/Interfaces/PartAExtensions.js.map +1 -1
- package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
- package/dist-esm/RequestResponseHeaders.js +1 -1
- package/dist-esm/StorageHelperFuncs.js +1 -1
- package/dist-esm/Telemetry/Common/Data.js +6 -11
- package/dist-esm/Telemetry/Common/Data.js.map +1 -1
- package/dist-esm/Telemetry/Common/DataPoint.js +8 -9
- package/dist-esm/Telemetry/Common/DataPoint.js.map +1 -1
- package/dist-esm/Telemetry/Common/DataSanitizer.js +1 -1
- package/dist-esm/Telemetry/Common/Envelope.js +12 -12
- package/dist-esm/Telemetry/Common/Envelope.js.map +1 -1
- package/dist-esm/Telemetry/Event.js +9 -12
- package/dist-esm/Telemetry/Event.js.map +1 -1
- package/dist-esm/Telemetry/Exception.js +74 -81
- package/dist-esm/Telemetry/Exception.js.map +1 -1
- package/dist-esm/Telemetry/Metric.js +9 -12
- package/dist-esm/Telemetry/Metric.js.map +1 -1
- package/dist-esm/Telemetry/PageView.js +12 -15
- package/dist-esm/Telemetry/PageView.js.map +1 -1
- package/dist-esm/Telemetry/PageViewPerformance.js +16 -19
- package/dist-esm/Telemetry/PageViewPerformance.js.map +1 -1
- package/dist-esm/Telemetry/RemoteDependencyData.js +17 -20
- package/dist-esm/Telemetry/RemoteDependencyData.js.map +1 -1
- package/dist-esm/Telemetry/Trace.js +10 -13
- package/dist-esm/Telemetry/Trace.js.map +1 -1
- package/dist-esm/TelemetryItemCreator.js +1 -1
- package/dist-esm/UrlHelperFuncs.js +1 -1
- package/dist-esm/Util.js +1 -1
- package/dist-esm/applicationinsights-common.js +3 -6
- package/dist-esm/applicationinsights-common.js.map +1 -1
- package/package.json +3 -3
- package/src/Interfaces/IExceptionTelemetry.ts +1 -1
- package/src/Interfaces/ITraceTelemetry.ts +1 -1
- package/src/Interfaces/PartAExtensions.ts +1 -1
- package/src/Interfaces/Telemetry/IEnvelope.ts +35 -3
- package/src/Telemetry/Common/Data.ts +12 -4
- package/src/Telemetry/Common/DataPoint.ts +38 -2
- package/src/Telemetry/Common/Envelope.ts +51 -10
- package/src/Telemetry/Event.ts +30 -12
- package/src/Telemetry/Exception.ts +158 -71
- package/src/Telemetry/Metric.ts +27 -7
- package/src/Telemetry/PageView.ts +45 -10
- package/src/Telemetry/PageViewPerformance.ts +75 -13
- package/src/Telemetry/RemoteDependencyData.ts +70 -15
- package/src/Telemetry/Trace.ts +34 -8
- package/src/applicationinsights-common.ts +5 -5
- package/types/Interfaces/IExceptionTelemetry.d.ts +1 -1
- package/types/Interfaces/ITraceTelemetry.d.ts +1 -1
- package/types/Interfaces/PartAExtensions.d.ts +1 -1
- package/types/Interfaces/Telemetry/IEnvelope.d.ts +24 -0
- package/types/Telemetry/Common/Data.d.ts +10 -2
- package/types/Telemetry/Common/DataPoint.d.ts +31 -2
- package/types/Telemetry/Common/Envelope.d.ts +35 -4
- package/types/Telemetry/Event.d.ts +19 -3
- package/types/Telemetry/Exception.d.ts +75 -7
- package/types/Telemetry/Metric.d.ts +19 -2
- package/types/Telemetry/PageView.d.ts +30 -2
- package/types/Telemetry/PageViewPerformance.d.ts +50 -2
- package/types/Telemetry/RemoteDependencyData.d.ts +46 -2
- package/types/Telemetry/Trace.d.ts +23 -3
- package/types/applicationinsights-common.d.ts +5 -5
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js +0 -27
- package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Base.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/Base.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js +0 -89
- package/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Data.js +0 -21
- package/dist-esm/Interfaces/Contracts/Generated/Data.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js +0 -21
- package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js +0 -16
- package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Domain.js +0 -8
- package/dist-esm/Interfaces/Contracts/Generated/Domain.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/Envelope.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/Envelope.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/EventData.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/EventData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js +0 -32
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js +0 -24
- package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/MessageData.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/MessageData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/MetricData.js +0 -32
- package/dist-esm/Interfaces/Contracts/Generated/MetricData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js +0 -34
- package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js +0 -34
- package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js +0 -32
- package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/RequestData.js +0 -28
- package/dist-esm/Interfaces/Contracts/Generated/RequestData.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js +0 -19
- package/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js.map +0 -1
- package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js +0 -17
- package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js.map +0 -1
- package/dist-esm/Telemetry/Common/Base.js +0 -22
- package/dist-esm/Telemetry/Common/Base.js.map +0 -1
- package/src/Interfaces/Contracts/Generated/AvailabilityData.ts +0 -57
- package/src/Interfaces/Contracts/Generated/Base.ts +0 -18
- package/src/Interfaces/Contracts/Generated/ContextTagKeys.ts +0 -299
- package/src/Interfaces/Contracts/Generated/Data.ts +0 -26
- package/src/Interfaces/Contracts/Generated/DataPoint.ts +0 -44
- package/src/Interfaces/Contracts/Generated/DataPointType.ts +0 -11
- package/src/Interfaces/Contracts/Generated/DependencyKind.ts +0 -12
- package/src/Interfaces/Contracts/Generated/DependencySourceType.ts +0 -12
- package/src/Interfaces/Contracts/Generated/Domain.ts +0 -10
- package/src/Interfaces/Contracts/Generated/Envelope.ts +0 -50
- package/src/Interfaces/Contracts/Generated/EventData.ts +0 -33
- package/src/Interfaces/Contracts/Generated/ExceptionData.ts +0 -40
- package/src/Interfaces/Contracts/Generated/ExceptionDetails.ts +0 -46
- package/src/Interfaces/Contracts/Generated/MessageData.ts +0 -39
- package/src/Interfaces/Contracts/Generated/MetricData.ts +0 -34
- package/src/Interfaces/Contracts/Generated/PageViewData.ts +0 -50
- package/src/Interfaces/Contracts/Generated/PageViewPerfData.ts +0 -70
- package/src/Interfaces/Contracts/Generated/RemoteDependencyData.ts +0 -68
- package/src/Interfaces/Contracts/Generated/RequestData.ts +0 -50
- package/src/Interfaces/Contracts/Generated/SeverityLevel.ts +0 -15
- package/src/Interfaces/Contracts/Generated/StackFrame.ts +0 -34
- package/src/Telemetry/Common/Base.ts +0 -14
- package/types/Interfaces/Contracts/Generated/AvailabilityData.d.ts +0 -42
- package/types/Interfaces/Contracts/Generated/Base.d.ts +0 -10
- package/types/Interfaces/Contracts/Generated/ContextTagKeys.d.ts +0 -175
- package/types/Interfaces/Contracts/Generated/Data.d.ts +0 -15
- package/types/Interfaces/Contracts/Generated/DataPoint.d.ts +0 -34
- package/types/Interfaces/Contracts/Generated/DataPointType.d.ts +0 -7
- package/types/Interfaces/Contracts/Generated/DependencyKind.d.ts +0 -8
- package/types/Interfaces/Contracts/Generated/DependencySourceType.d.ts +0 -8
- package/types/Interfaces/Contracts/Generated/Domain.d.ts +0 -5
- package/types/Interfaces/Contracts/Generated/Envelope.d.ts +0 -38
- package/types/Interfaces/Contracts/Generated/EventData.d.ts +0 -23
- package/types/Interfaces/Contracts/Generated/ExceptionData.d.ts +0 -29
- package/types/Interfaces/Contracts/Generated/ExceptionDetails.d.ts +0 -34
- package/types/Interfaces/Contracts/Generated/MessageData.d.ts +0 -28
- package/types/Interfaces/Contracts/Generated/MetricData.d.ts +0 -24
- package/types/Interfaces/Contracts/Generated/PageViewData.d.ts +0 -35
- package/types/Interfaces/Contracts/Generated/PageViewPerfData.d.ts +0 -51
- package/types/Interfaces/Contracts/Generated/RemoteDependencyData.d.ts +0 -51
- package/types/Interfaces/Contracts/Generated/RequestData.d.ts +0 -38
- package/types/Interfaces/Contracts/Generated/SeverityLevel.d.ts +0 -10
- package/types/Interfaces/Contracts/Generated/StackFrame.d.ts +0 -25
- package/types/Telemetry/Common/Base.d.ts +0 -8
package/src/Telemetry/Event.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { EventData } from "../Interfaces/Contracts/Generated/EventData";
|
|
4
|
+
import { IEventData } from "../Interfaces/Contracts/IEventData";
|
|
6
5
|
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
7
6
|
import { dataSanitizeString, dataSanitizeProperties, dataSanitizeMeasurements } from "./Common/DataSanitizer";
|
|
8
7
|
import { FieldType } from "../Enums";
|
|
9
8
|
import { strNotSpecified } from "../Constants";
|
|
9
|
+
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
10
10
|
|
|
11
|
-
export class Event
|
|
12
|
-
|
|
11
|
+
export class Event implements IEventData, ISerializable {
|
|
13
12
|
public static envelopeType = "Microsoft.ApplicationInsights.{0}.Event";
|
|
14
13
|
public static dataType = "EventData";
|
|
15
14
|
|
|
@@ -18,17 +17,36 @@ export class Event extends EventData implements ISerializable {
|
|
|
18
17
|
name: FieldType.Required,
|
|
19
18
|
properties: FieldType.Default,
|
|
20
19
|
measurements: FieldType.Default
|
|
21
|
-
}
|
|
20
|
+
};
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
|
-
*
|
|
23
|
+
* Schema version
|
|
25
24
|
*/
|
|
26
|
-
|
|
25
|
+
public ver: number; /* 2 */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Event name. Keep it low cardinality to allow proper grouping and useful metrics.
|
|
29
|
+
*/
|
|
30
|
+
public name: string;
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Collection of custom properties.
|
|
34
|
+
*/
|
|
35
|
+
public properties: any; /* {} */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Collection of custom measurements.
|
|
39
|
+
*/
|
|
40
|
+
public measurements: any; /* {} */
|
|
29
41
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Constructs a new instance of the EventTelemetry object
|
|
44
|
+
*/
|
|
45
|
+
constructor(logger: IDiagnosticLogger, name: string, properties?: any, measurements?: any) {
|
|
46
|
+
let _self = this;
|
|
47
|
+
_self.ver = 2;
|
|
48
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
49
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
50
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
33
51
|
}
|
|
34
|
-
}
|
|
52
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { IStackFrame } from "../Interfaces/Contracts/IStackFrame";
|
|
5
|
+
import { IExceptionData } from "../Interfaces/Contracts/IExceptionData";
|
|
6
|
+
import { IExceptionDetails } from "../Interfaces/Contracts/IExceptionDetails";
|
|
7
7
|
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
8
8
|
import { dataSanitizeException, dataSanitizeMeasurements, dataSanitizeMessage, dataSanitizeProperties, dataSanitizeString } from "./Common/DataSanitizer";
|
|
9
9
|
import { FieldType } from "../Enums";
|
|
10
|
-
import { SeverityLevel } from "../Interfaces/Contracts/
|
|
10
|
+
import { SeverityLevel } from "../Interfaces/Contracts/SeverityLevel";
|
|
11
11
|
import { IDiagnosticLogger, isNullOrUndefined, arrMap, isString, strTrim, isArray, isError, arrForEach, isObject, isFunction } from "@microsoft/applicationinsights-core-js";
|
|
12
12
|
import {
|
|
13
13
|
IExceptionInternal, IExceptionDetailsInternal, IExceptionStackFrameInternal, IAutoExceptionTelemetry, IStackDetails
|
|
@@ -310,7 +310,7 @@ export function _formatErrorCode(errorObj:any) {
|
|
|
310
310
|
return "" + (errorObj || "");
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
export class Exception
|
|
313
|
+
export class Exception implements IExceptionData, ISerializable {
|
|
314
314
|
|
|
315
315
|
public static envelopeType = "Microsoft.ApplicationInsights.{0}.Exception";
|
|
316
316
|
public static dataType = "ExceptionData";
|
|
@@ -327,44 +327,68 @@ export class Exception extends ExceptionData implements ISerializable {
|
|
|
327
327
|
measurements: FieldType.Default
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Schema version
|
|
332
|
+
*/
|
|
333
|
+
public ver: number; /* 2 */
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Exception chain - list of inner exceptions.
|
|
337
|
+
*/
|
|
338
|
+
public exceptions: IExceptionDetails[]; /* [] */
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Severity level. Mostly used to indicate exception severity level when it is reported by logging library.
|
|
342
|
+
*/
|
|
343
|
+
public severityLevel: SeverityLevel;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Collection of custom properties.
|
|
347
|
+
*/
|
|
348
|
+
public properties: any;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Collection of custom measurements.
|
|
352
|
+
*/
|
|
353
|
+
public measurements: any;
|
|
354
|
+
|
|
330
355
|
/**
|
|
331
356
|
* Constructs a new instance of the ExceptionTelemetry object
|
|
332
357
|
*/
|
|
333
358
|
constructor(logger: IDiagnosticLogger, exception: Error | IExceptionInternal | IAutoExceptionTelemetry, properties?: {[key: string]: any}, measurements?: {[key: string]: number}, severityLevel?: SeverityLevel, id?: string) {
|
|
334
|
-
|
|
335
|
-
|
|
359
|
+
let _self = this;
|
|
360
|
+
_self.ver = 2; // TODO: handle the CS"4.0" ==> breeze 2 conversion in a better way
|
|
336
361
|
if (!_isExceptionInternal(exception)) {
|
|
337
362
|
if (!properties) {
|
|
338
363
|
properties = { };
|
|
339
364
|
}
|
|
340
365
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
366
|
+
_self.exceptions = [new _ExceptionDetails(logger, exception, properties)];
|
|
367
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
368
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
344
369
|
if (severityLevel) {
|
|
345
|
-
|
|
370
|
+
_self.severityLevel = severityLevel;
|
|
346
371
|
}
|
|
347
372
|
if (id) {
|
|
348
|
-
|
|
373
|
+
_self.id = id;
|
|
349
374
|
}
|
|
350
375
|
} else {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
376
|
+
_self.exceptions = exception.exceptions || [];
|
|
377
|
+
_self.properties = exception.properties;
|
|
378
|
+
_self.measurements = exception.measurements;
|
|
354
379
|
if (exception.severityLevel) {
|
|
355
|
-
|
|
380
|
+
_self.severityLevel = exception.severityLevel;
|
|
356
381
|
}
|
|
357
382
|
if (exception.id) {
|
|
358
|
-
|
|
383
|
+
_self.id = exception.id;
|
|
359
384
|
}
|
|
360
385
|
if (exception.problemGroup) {
|
|
361
|
-
|
|
386
|
+
_self.problemGroup = exception.problemGroup;
|
|
362
387
|
}
|
|
363
388
|
|
|
364
389
|
// bool/int types, use isNullOrUndefined
|
|
365
|
-
this.ver = 2; // TODO: handle the CS"4.0" ==> breeze 2 conversion in a better way
|
|
366
390
|
if (!isNullOrUndefined(exception.isManual)) {
|
|
367
|
-
|
|
391
|
+
_self.isManual = exception.isManual;
|
|
368
392
|
}
|
|
369
393
|
}
|
|
370
394
|
}
|
|
@@ -434,7 +458,7 @@ export class Exception extends ExceptionData implements ISerializable {
|
|
|
434
458
|
message,
|
|
435
459
|
stack: details,
|
|
436
460
|
typeName
|
|
437
|
-
} as
|
|
461
|
+
} as IExceptionDetails
|
|
438
462
|
]
|
|
439
463
|
} as Exception;
|
|
440
464
|
}
|
|
@@ -442,7 +466,7 @@ export class Exception extends ExceptionData implements ISerializable {
|
|
|
442
466
|
public static formatError = _formatErrorCode;
|
|
443
467
|
}
|
|
444
468
|
|
|
445
|
-
export class _ExceptionDetails
|
|
469
|
+
export class _ExceptionDetails implements IExceptionDetails, ISerializable {
|
|
446
470
|
|
|
447
471
|
public aiDataContract = {
|
|
448
472
|
id: FieldType.Default,
|
|
@@ -454,9 +478,43 @@ export class _ExceptionDetails extends ExceptionDetails implements ISerializable
|
|
|
454
478
|
parsedStack: FieldType.Array
|
|
455
479
|
};
|
|
456
480
|
|
|
457
|
-
|
|
458
|
-
|
|
481
|
+
/**
|
|
482
|
+
* In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting.
|
|
483
|
+
*/
|
|
484
|
+
public id: number;
|
|
459
485
|
|
|
486
|
+
/**
|
|
487
|
+
* The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception
|
|
488
|
+
*/
|
|
489
|
+
public outerId: number;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Exception type name.
|
|
493
|
+
*/
|
|
494
|
+
public typeName: string;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Exception message.
|
|
498
|
+
*/
|
|
499
|
+
public message: string;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Indicates if full exception stack is provided in the exception. The stack may be trimmed, such as in the case of a StackOverflow exception.
|
|
503
|
+
*/
|
|
504
|
+
public hasFullStack: boolean;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Text describing the stack. Either stack or parsedStack should have a value.
|
|
508
|
+
*/
|
|
509
|
+
public stack: string;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* List of stack frames. Either stack or parsedStack should have a value.
|
|
513
|
+
*/
|
|
514
|
+
public parsedStack: IStackFrame[]; /* [] */
|
|
515
|
+
|
|
516
|
+
constructor(logger: IDiagnosticLogger, exception: Error | IExceptionDetailsInternal | IAutoExceptionTelemetry, properties?: {[key: string]: any}) {
|
|
517
|
+
let _self = this;
|
|
460
518
|
if (!_isExceptionDetailsInternal(exception)) {
|
|
461
519
|
let error = exception as any;
|
|
462
520
|
let evt = error && error.evt;
|
|
@@ -464,36 +522,37 @@ export class _ExceptionDetails extends ExceptionDetails implements ISerializable
|
|
|
464
522
|
error = error[strError] || evt || error;
|
|
465
523
|
}
|
|
466
524
|
|
|
467
|
-
|
|
468
|
-
|
|
525
|
+
_self.typeName = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified;
|
|
526
|
+
_self.message = dataSanitizeMessage(logger, _formatMessage(exception || error, _self.typeName)) || strNotSpecified;
|
|
469
527
|
const stack = exception[strStackDetails] || _getStackFromErrorObj(exception);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
528
|
+
_self.parsedStack = _parseStack(stack);
|
|
529
|
+
_self[strStack] = dataSanitizeException(logger, _formatStackTrace(stack));
|
|
530
|
+
_self.hasFullStack = isArray(_self.parsedStack) && _self.parsedStack.length > 0;
|
|
473
531
|
|
|
474
532
|
if (properties) {
|
|
475
|
-
properties.typeName = properties.typeName ||
|
|
533
|
+
properties.typeName = properties.typeName || _self.typeName;
|
|
476
534
|
}
|
|
477
535
|
} else {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
536
|
+
_self.typeName = exception.typeName;
|
|
537
|
+
_self.message = exception.message;
|
|
538
|
+
_self[strStack] = exception[strStack];
|
|
539
|
+
_self.parsedStack = exception.parsedStack || [];
|
|
540
|
+
_self.hasFullStack = exception.hasFullStack;
|
|
483
541
|
}
|
|
484
542
|
}
|
|
485
543
|
|
|
486
544
|
public toInterface(): IExceptionDetailsInternal {
|
|
487
|
-
|
|
488
|
-
|
|
545
|
+
let _self = this;
|
|
546
|
+
const parsedStack = _self.parsedStack instanceof Array
|
|
547
|
+
&& arrMap(_self.parsedStack, (frame: _StackFrame) => frame.toInterface());
|
|
489
548
|
|
|
490
549
|
const exceptionDetailsInterface: IExceptionDetailsInternal = {
|
|
491
|
-
id:
|
|
492
|
-
outerId:
|
|
493
|
-
typeName:
|
|
494
|
-
message:
|
|
495
|
-
hasFullStack:
|
|
496
|
-
stack:
|
|
550
|
+
id: _self.id,
|
|
551
|
+
outerId: _self.outerId,
|
|
552
|
+
typeName: _self.typeName,
|
|
553
|
+
message: _self.message,
|
|
554
|
+
hasFullStack: _self.hasFullStack,
|
|
555
|
+
stack: _self[strStack],
|
|
497
556
|
parsedStack: parsedStack || undefined
|
|
498
557
|
};
|
|
499
558
|
|
|
@@ -511,13 +570,14 @@ export class _ExceptionDetails extends ExceptionDetails implements ISerializable
|
|
|
511
570
|
}
|
|
512
571
|
}
|
|
513
572
|
|
|
514
|
-
export class _StackFrame
|
|
573
|
+
export class _StackFrame implements IStackFrame, ISerializable {
|
|
515
574
|
|
|
516
575
|
// regex to match stack frames from ie/chrome/ff
|
|
517
576
|
// methodName=$2, fileName=$4, lineNo=$5, column=$6
|
|
518
577
|
public static regex = /^([\s]+at)?[\s]{0,50}([^\@\()]+?)[\s]{0,50}(\@|\()([^\(\n]+):([0-9]+):([0-9]+)(\)?)$/;
|
|
519
578
|
public static baseSize = 58; // '{"method":"","level":,"assembly":"","fileName":"","line":}'.length
|
|
520
|
-
|
|
579
|
+
|
|
580
|
+
public sizeInBytes: number; /* 0 */
|
|
521
581
|
|
|
522
582
|
public aiDataContract = {
|
|
523
583
|
level: FieldType.Required,
|
|
@@ -527,41 +587,67 @@ export class _StackFrame extends StackFrame implements ISerializable {
|
|
|
527
587
|
line: FieldType.Default
|
|
528
588
|
};
|
|
529
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Level in the call stack. For the long stacks SDK may not report every function in a call stack.
|
|
592
|
+
*/
|
|
593
|
+
public level: number;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Method name.
|
|
597
|
+
*/
|
|
598
|
+
public method: string;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Name of the assembly (dll, jar, etc.) containing this function.
|
|
602
|
+
*/
|
|
603
|
+
public assembly: string;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* File name or URL of the method implementation.
|
|
607
|
+
*/
|
|
608
|
+
public fileName: string;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Line number of the code implementation.
|
|
612
|
+
*/
|
|
613
|
+
public line: number;
|
|
614
|
+
|
|
530
615
|
constructor(sourceFrame: string | IExceptionStackFrameInternal, level: number) {
|
|
531
|
-
|
|
616
|
+
let _self = this;
|
|
617
|
+
_self.sizeInBytes = 0;
|
|
532
618
|
|
|
533
619
|
// Not converting this to isString() as typescript uses this logic to "understand" the different
|
|
534
620
|
// types for the 2 different code paths
|
|
535
621
|
if (typeof sourceFrame === "string") {
|
|
536
622
|
const frame: string = sourceFrame;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
623
|
+
_self.level = level;
|
|
624
|
+
_self.method = NoMethod;
|
|
625
|
+
_self.assembly = strTrim(frame);
|
|
626
|
+
_self.fileName = "";
|
|
627
|
+
_self.line = 0;
|
|
542
628
|
const matches = frame.match(_StackFrame.regex);
|
|
543
629
|
if (matches && matches.length >= 5) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
630
|
+
_self.method = strTrim(matches[2]) || _self.method;
|
|
631
|
+
_self.fileName = strTrim(matches[4]);
|
|
632
|
+
_self.line = parseInt(matches[5]) || 0;
|
|
547
633
|
}
|
|
548
634
|
} else {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
635
|
+
_self.level = sourceFrame.level;
|
|
636
|
+
_self.method = sourceFrame.method;
|
|
637
|
+
_self.assembly = sourceFrame.assembly;
|
|
638
|
+
_self.fileName = sourceFrame.fileName;
|
|
639
|
+
_self.line = sourceFrame.line;
|
|
640
|
+
_self.sizeInBytes = 0;
|
|
555
641
|
}
|
|
556
642
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
643
|
+
_self.sizeInBytes += _self.method.length;
|
|
644
|
+
_self.sizeInBytes += _self.fileName.length;
|
|
645
|
+
_self.sizeInBytes += _self.assembly.length;
|
|
560
646
|
|
|
561
647
|
// todo: these might need to be removed depending on how the back-end settles on their size calculation
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
648
|
+
_self.sizeInBytes += _StackFrame.baseSize;
|
|
649
|
+
_self.sizeInBytes += _self.level.toString().length;
|
|
650
|
+
_self.sizeInBytes += _self.line.toString().length;
|
|
565
651
|
}
|
|
566
652
|
|
|
567
653
|
public static CreateFromInterface(frame: IExceptionStackFrameInternal) {
|
|
@@ -569,12 +655,13 @@ export class _StackFrame extends StackFrame implements ISerializable {
|
|
|
569
655
|
}
|
|
570
656
|
|
|
571
657
|
public toInterface() {
|
|
658
|
+
let _self = this;
|
|
572
659
|
return {
|
|
573
|
-
level:
|
|
574
|
-
method:
|
|
575
|
-
assembly:
|
|
576
|
-
fileName:
|
|
577
|
-
line:
|
|
660
|
+
level: _self.level,
|
|
661
|
+
method: _self.method,
|
|
662
|
+
assembly: _self.assembly,
|
|
663
|
+
fileName: _self.fileName,
|
|
664
|
+
line: _self.line
|
|
578
665
|
};
|
|
579
666
|
}
|
|
580
667
|
}
|
package/src/Telemetry/Metric.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { IMetricData } from "../Interfaces/Contracts/IMetricData";
|
|
5
5
|
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
6
6
|
import { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from "./Common/DataSanitizer";
|
|
7
7
|
import { FieldType } from "../Enums";
|
|
@@ -9,7 +9,7 @@ import { DataPoint } from "./Common/DataPoint";
|
|
|
9
9
|
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
10
10
|
import { strNotSpecified } from "../Constants";
|
|
11
11
|
|
|
12
|
-
export class Metric
|
|
12
|
+
export class Metric implements IMetricData, ISerializable {
|
|
13
13
|
|
|
14
14
|
public static envelopeType = "Microsoft.ApplicationInsights.{0}.Metric";
|
|
15
15
|
public static dataType = "MetricData";
|
|
@@ -20,12 +20,32 @@ export class Metric extends MetricData implements ISerializable {
|
|
|
20
20
|
properties: FieldType.Default
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Schema version
|
|
25
|
+
*/
|
|
26
|
+
public ver: number; /* 2 */
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used.
|
|
30
|
+
*/
|
|
31
|
+
public metrics: DataPoint[]; /* [] */
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Collection of custom properties.
|
|
35
|
+
*/
|
|
36
|
+
properties: any; /* {} */
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Collection of custom measurements.
|
|
40
|
+
*/
|
|
41
|
+
measurements: any; /* {} */
|
|
42
|
+
|
|
23
43
|
/**
|
|
24
44
|
* Constructs a new instance of the MetricTelemetry object
|
|
25
45
|
*/
|
|
26
46
|
constructor(logger: IDiagnosticLogger, name: string, value: number, count?: number, min?: number, max?: number, stdDev?: number, properties?: any, measurements?: { [key: string]: number }) {
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
let _self = this;
|
|
48
|
+
_self.ver = 2;
|
|
29
49
|
const dataPoint = new DataPoint();
|
|
30
50
|
dataPoint.count = count > 0 ? count : undefined;
|
|
31
51
|
dataPoint.max = isNaN(max) || max === null ? undefined : max;
|
|
@@ -34,8 +54,8 @@ export class Metric extends MetricData implements ISerializable {
|
|
|
34
54
|
dataPoint.value = value;
|
|
35
55
|
dataPoint.stdDev = isNaN(stdDev) || stdDev === null ? undefined : stdDev;
|
|
36
56
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
_self.metrics = [dataPoint];
|
|
58
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
59
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
40
60
|
}
|
|
41
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { IPageViewData } from "../Interfaces/Contracts/IPageViewData";
|
|
5
5
|
import { dataSanitizeId, dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from "./Common/DataSanitizer";
|
|
6
6
|
import { ISerializable } from "../Interfaces/Telemetry/ISerializable";
|
|
7
7
|
import { FieldType } from "../Enums";
|
|
@@ -9,7 +9,7 @@ import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
|
9
9
|
import { msToTimeSpan } from "../HelperFuncs";
|
|
10
10
|
import { strNotSpecified } from "../Constants";
|
|
11
11
|
|
|
12
|
-
export class PageView
|
|
12
|
+
export class PageView implements IPageViewData, ISerializable {
|
|
13
13
|
|
|
14
14
|
public static envelopeType = "Microsoft.ApplicationInsights.{0}.Pageview";
|
|
15
15
|
public static dataType = "PageviewData";
|
|
@@ -24,19 +24,54 @@ export class PageView extends PageViewData implements ISerializable {
|
|
|
24
24
|
id: FieldType.Default
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Schema version
|
|
29
|
+
*/
|
|
30
|
+
public ver: number; // = 2;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Event name. Keep it low cardinality to allow proper grouping and useful metrics.
|
|
34
|
+
*/
|
|
35
|
+
public name: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Collection of custom properties.
|
|
39
|
+
*/
|
|
40
|
+
public properties: any; // = {};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Collection of custom measurements.
|
|
44
|
+
*/
|
|
45
|
+
public measurements: any; // = {};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Request URL with all query string parameters
|
|
49
|
+
*/
|
|
50
|
+
public url: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days.
|
|
54
|
+
*/
|
|
55
|
+
public duration: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Identifier of a page view instance. Used for correlation between page view and other telemetry items.
|
|
59
|
+
*/
|
|
60
|
+
public id: string;
|
|
61
|
+
|
|
27
62
|
/**
|
|
28
63
|
* Constructs a new instance of the PageEventTelemetry object
|
|
29
64
|
*/
|
|
30
65
|
constructor(logger: IDiagnosticLogger, name?: string, url?: string, durationMs?: number, properties?: {[key: string]: string}, measurements?: {[key: string]: number}, id?: string) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
let _self = this;
|
|
67
|
+
_self.ver = 2;
|
|
68
|
+
_self.id = dataSanitizeId(logger, id);
|
|
69
|
+
_self.url = dataSanitizeUrl(logger, url);
|
|
70
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
36
71
|
if (!isNaN(durationMs)) {
|
|
37
|
-
|
|
72
|
+
_self.duration = msToTimeSpan(durationMs);
|
|
38
73
|
}
|
|
39
|
-
|
|
40
|
-
|
|
74
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
75
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
41
76
|
}
|
|
42
77
|
}
|