Skip to content

Commit

Permalink
Chrome debug extension UI (#1703)
Browse files Browse the repository at this point in the history
* [BUG] Field 'ai.operation.name' on type 'ContextTagKeys' is too long. Expected: 1024 characters" #1692 (#1693)

* [BUG] Multiple errors are getting thrown and swallowed during initialization when no instrumentation Key is provided #1691 (#1695)

* Governance Updates -- update used dependencies (#1694)

* init

* working

* add css

* copy over helper and debugplugin ui

* update style

* Shrinkwrap update after rush update

* Accessibility fixes

* Fix accessibility in the configuration page

* Fix missing red line between sessions

* align styles

* Added update instructions to the configuration page, and replaced placeholder link for preset creation instructions

* fix build

Co-authored-by: Nev <54870357+MSNev@users.noreply.github.com>
Co-authored-by: Kevin Brown <kevbrown@microsoft.com>
  • Loading branch information
3 people committed Nov 2, 2021
1 parent 1f16954 commit f02053e
Show file tree
Hide file tree
Showing 43 changed files with 2,314 additions and 1,443 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
"typescript.tsdk": "./node_modules/typescript/lib",
"files.exclude": {
"**/.tscache": true
},
"markdownlint.config": {
"MD028": false,
"MD025": {
"front_matter_title": ""
}
}
}
1 change: 0 additions & 1 deletion AISKULight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^5.0.1",
"grunt-run": "^0.8.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"@nevware21/grunt-eslint-ts": "^0.2.2",
"globby": "^11.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1530,5 +1530,49 @@ export class SenderTests extends AITestClass {
QUnit.assert.equal(SendRequestReason.MaxBatchSize, sendNotifications[0].sendReason);
}
});

this.testCase({
name: 'Envelope: operation.name is correctly truncated if required',
test: () => {
const excessiveName = new Array(1234).join("a"); // exceeds max of 1024

const bd = new Exception(
null,
new Error(),
{"property1": "val1", "property2": "val2" },
{"measurement1": 50.0, "measurement2": 1.3 }
);
const inputEnvelope: ITelemetryItem = {
name: "test",
time: new Date("2018-06-12").toISOString(),
iKey: "iKey",
baseType: Exception.dataType,
baseData: bd,
data: {
"property3": "val3",
"measurement3": 3.0
},
ext: {
"trace": {
"traceID": "1528B5FF-6455-4657-BE77-E6664CAC72DC",
"parentID": "1528B5FF-6455-4657-BE77-E6664CACEEEE",
"name": excessiveName
}
},
tags: [
{"user.accountId": "TestAccountId"},
],
};

// Act
const appInsightsEnvelope = Sender.constructEnvelope(inputEnvelope, this._instrumentationKey, null);
const baseData = appInsightsEnvelope.data.baseData;

QUnit.assert.equal("val3", baseData.properties["property3"], "ExceptionData: customProperties (item.data) are added to the properties of the envelope and not included in the item.data")
QUnit.assert.equal("val1", baseData.properties["property1"], "ExceptionData: properties (item.baseData.properties) are added to telemetry envelope");
QUnit.assert.equal(50.0, baseData.measurements["measurement1"], "ExceptionData: measurements (item.baseData.measurements) are added to telemetry envelope");
QUnit.assert.equal(1024, appInsightsEnvelope.tags["ai.operation.name"].length, "The ai.operation.name should have been truncated to the maximum");
}
});
}
}
1 change: 0 additions & 1 deletion channels/applicationinsights-channel-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@types/sinon": "4.3.3",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-run": "^0.8.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"@nevware21/grunt-eslint-ts": "^0.2.2",
"globby": "^11.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
IPageViewPerformanceTelemetry, CtxTagKeys,
HttpMethod, IPageViewTelemetryInternal, IWeb,
IExceptionInternal,
SampleRate
SampleRate,
dataSanitizeString
} from "@microsoft/applicationinsights-common";
import {
ITelemetryItem, IDiagnosticLogger, LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey,
Expand All @@ -25,7 +26,7 @@ function _setValueIf<T>(target:T, field:keyof T, value:any) {
/*
* Maps Part A data from CS 4.0
*/
function _extractPartAExtensions(item: ITelemetryItem, env: IEnvelope) {
function _extractPartAExtensions(logger: IDiagnosticLogger, item: ITelemetryItem, env: IEnvelope) {
// todo: switch to keys from common in this method
let envTags = env.tags = env.tags || {};
let itmExt = item.ext = item.ext || {};
Expand Down Expand Up @@ -77,7 +78,7 @@ function _extractPartAExtensions(item: ITelemetryItem, env: IEnvelope) {
let extTrace = itmExt.trace;
if (extTrace) {
_setValueIf(envTags, CtxTagKeys.operationParentId, extTrace.parentID);
_setValueIf(envTags, CtxTagKeys.operationName, extTrace.name);
_setValueIf(envTags, CtxTagKeys.operationName, dataSanitizeString(logger, extTrace.name));
_setValueIf(envTags, CtxTagKeys.operationId, extTrace.traceID);
}

Expand Down Expand Up @@ -157,7 +158,7 @@ function _createEnvelope<T>(logger: IDiagnosticLogger, envelopeType: string, tel
envelope.name = envelope.name.replace("{0}", iKeyNoDashes);

// extract all extensions from ctx
_extractPartAExtensions(telemetryItem, envelope);
_extractPartAExtensions(logger, telemetryItem, envelope);

// loop through the envelope tags (extension of Part A) and pick out the ones that should go in outgoing envelope tags
telemetryItem.tags = telemetryItem.tags || [];
Expand Down
Loading

0 comments on commit f02053e

Please sign in to comment.