Skip to content

Commit

Permalink
Added changes for orgGeo (#1093)
Browse files Browse the repository at this point in the history
  • Loading branch information
BidishaMS authored Jan 22, 2025
1 parent dee1cf7 commit ea84f9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/common/OneDSLoggerTelemetry/IEventTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ export interface IContextInfo {
referrer?: string;
envId?: string;
referrerSource?: string;
orgGeo?: string;
sku?: string;
}
9 changes: 4 additions & 5 deletions src/common/OneDSLoggerTelemetry/oneDSLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class OneDSLogger implements ITelemetryLogger {
private static userInfo: IUserInfo = { oid: "", tid: "", puid: "" };
private static contextInfo: IContextInfo;
private static userRegion: string = "";
private static orgGeo: string = "";

private readonly regexPatternsToRedact = [
/key["\\ ']*[:=]+["\\ ']*([a-zA-Z0-9]*)/igm,
Expand Down Expand Up @@ -131,7 +132,6 @@ export class OneDSLogger implements ITelemetryLogger {
referrer: "",
envId: "",
referrerSource: "",
orgGeo: "",
sku: ""
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ export class OneDSLogger implements ITelemetryLogger {
envelope.data.puid = OneDSLogger.userInfo?.puid;
envelope.data.context = JSON.stringify(OneDSLogger.contextInfo);
envelope.data.userRegion = OneDSLogger.userRegion;
envelope.data.orgGeo = OneDSLogger.contextInfo.orgGeo;
envelope.data.orgGeo = OneDSLogger.orgGeo;
// At the end of event enrichment, redact the sensitive data for all the applicable fields
// envelope = this.redactSensitiveDataFromEvent(envelope);
}
Expand Down Expand Up @@ -362,15 +362,14 @@ export class OneDSLogger implements ITelemetryLogger {
OneDSLogger.contextInfo.referrer = eventInfo.referrer ?? '';
OneDSLogger.contextInfo.envId = eventInfo.envId ?? '';
OneDSLogger.contextInfo.referrerSource = eventInfo.referrerSource ?? '';
OneDSLogger.contextInfo.orgGeo = eventInfo.orgGeo ?? '';
OneDSLogger.contextInfo.sku = eventInfo.sku ?? '';
}

if (envelope.data.eventName == webExtensionTelemetryEventNames.WEB_EXTENSION_DATAVERSE_AUTHENTICATION_COMPLETED) {
OneDSLogger.userInfo.oid = JSON.parse(envelope.data.eventInfo).userId;
}
if (envelope.data.eventName == webExtensionTelemetryEventNames.WEB_EXTENSION_ORG_GEO) {
OneDSLogger.contextInfo.orgGeo = JSON.parse(envelope.data.eventInfo).orgGeo;
OneDSLogger.orgGeo = JSON.parse(envelope.data.eventInfo).orgGeo;
}
}

Expand All @@ -379,7 +378,7 @@ export class OneDSLogger implements ITelemetryLogger {
if (envelope.data.eventName == desktopExtTelemetryEventNames.DESKTOP_EXTENSION_INIT_CONTEXT) {
OneDSLogger.contextInfo.orgId = JSON.parse(envelope.data.eventInfo).OrgId;
OneDSLogger.contextInfo.envId = JSON.parse(envelope.data.eventInfo).EnvironmentId;
OneDSLogger.contextInfo.orgGeo = JSON.parse(envelope.data.eventInfo).orgGeo;
OneDSLogger.orgGeo = JSON.parse(envelope.data.eventInfo).orgGeo;
OneDSLogger.userInfo.oid = JSON.parse(envelope.data.eventInfo).AadId;
// TODO: Populate website id
OneDSLogger.contextInfo.websiteId = 'test'
Expand Down

0 comments on commit ea84f9c

Please sign in to comment.