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

[Main] v3.1.x change Disable UserAgent config to true by default #2028 #2231

Merged
merged 3 commits into from
Jan 9, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -634,18 +634,20 @@ export class PropertiesTests extends AITestClass {
});

this.testCase({
name: 'User: track is triggered if user context is first time initialized',
name: 'User: track is triggered if user context is first time initialized and _disableUserInitMessage is set to false',
useFakeTimers: true,
test: () => {
// setup
var setCookieStub = this.sandbox.stub(this as any, "_setCookie").callsFake(() => {});
var loggingStub = this.sandbox.stub(this.core.logger, "logInternalMessage");

// Act
Assert.ok(setCookieStub.notCalled, 'Cookie not yet generated');
Assert.ok(loggingStub.notCalled, 'logInternalMessage is not yet triggered');
this.properties.initialize(this.getEmptyConfig(), this.core, []);
this.core.initialize(this.getEmptyConfig(), [this.properties]);
Assert.ok(setCookieStub.called, 'Cookie generated');

var loggingStub = this.sandbox.stub(this.core.logger, "logInternalMessage");
Assert.ok(loggingStub.notCalled, 'logInternalMessage is not yet triggered');

this.core.config["disableUserInitMessage"] = false;
this.clock.tick(1000);

// Assert
Assert.equal(true, this.properties.context.user.isNewUser, 'current user is a new user');
const item: ITelemetryItem = {name: 'item'};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class PropertiesPlugin extends BaseTelemetryPlugin implements IPr
_distributedTraceCtx = null;
_previousTraceCtx = null;
_context = null;
_disableUserInitMessage = false;
_disableUserInitMessage = true;
}

function _populateDefaults(config: IConfiguration & IConfig) {
Expand All @@ -139,7 +139,7 @@ export default class PropertiesPlugin extends BaseTelemetryPlugin implements IPr
if (config.storagePrefix){
utlSetStoragePrefix(config.storagePrefix);
}
_disableUserInitMessage = config.disableUserInitMessage || false;
_disableUserInitMessage = config.disableUserInitMessage === false ? false : true;
_extensionConfig = ctx.getExtCfg(identifier, _defaultConfig);

// Test hook to allow accessing the internal values -- explicitly not defined as an available property on the class
Expand Down
Loading