Skip to content

Commit

Permalink
Merge pull request #215 from software-mansion-labs/propagate-session-…
Browse files Browse the repository at this point in the history
…id-metadata

Propagate session ID metadata
  • Loading branch information
lramos15 authored Nov 19, 2024
2 parents fd4491b + be6e207 commit eaf9dc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/browser/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getBrowserRelease(navigator: Navigator): string {

export default class TelemetryReporter extends BaseTelemetryReporter {
constructor(connectionString: string, replacementOptions?: ReplacementOption[]) {
let clientFactory = (connectionString: string) => appInsightsClientFactory(connectionString, vscode.env.machineId, undefined, replacementOptions);
let clientFactory = (connectionString: string) => appInsightsClientFactory(connectionString, vscode.env.machineId, vscode.env.sessionId, undefined, replacementOptions);
// If key is usable by 1DS use the 1DS SDk
if (TelemetryUtil.shouldUseOneDataSystemSDK(connectionString)) {
clientFactory = (key: string) => oneDataSystemClientFactory(key, vscode);
Expand Down
4 changes: 2 additions & 2 deletions src/common/appInsightsClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ReplacementOption, SenderData } from "./baseTelemetryReporter";
import { BaseTelemetryClient } from "./baseTelemetrySender";
import { TelemetryUtil } from "./util";

export const appInsightsClientFactory = async (connectionString: string, machineId: string, xhrOverride?: IXHROverride, replacementOptions?: ReplacementOption[]): Promise<BaseTelemetryClient> => {
export const appInsightsClientFactory = async (connectionString: string, machineId: string, sessionId: string, xhrOverride?: IXHROverride, replacementOptions?: ReplacementOption[]): Promise<BaseTelemetryClient> => {
let appInsightsClient: ApplicationInsights | undefined;
try {
const basicAISDK = await import/* webpackMode: "eager" */("@microsoft/applicationinsights-web-basic");
Expand Down Expand Up @@ -52,7 +52,7 @@ export const appInsightsClientFactory = async (connectionString: string, machine
name: eventName,
data: properties,
baseType: "EventData",
ext: { user: { id: machineId, authId: machineId } },
ext: { user: { id: machineId, authId: machineId }, app: { sesId: sessionId } },
baseData: { name: eventName, properties: data?.properties, measurements: data?.measurements }
});
},
Expand Down
2 changes: 1 addition & 1 deletion src/node/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function getXHROverride() {

export default class TelemetryReporter extends BaseTelemetryReporter {
constructor(connectionString: string, replacementOptions?: ReplacementOption[]) {
let clientFactory = (connectionString: string) => appInsightsClientFactory(connectionString, vscode.env.machineId, getXHROverride(), replacementOptions);
let clientFactory = (connectionString: string) => appInsightsClientFactory(connectionString, vscode.env.machineId, vscode.env.sessionId, getXHROverride(), replacementOptions);
// If connection string is usable by 1DS use the 1DS SDk
if (TelemetryUtil.shouldUseOneDataSystemSDK(connectionString)) {
clientFactory = (key: string) => oneDataSystemClientFactory(key, vscode, getXHROverride());
Expand Down

0 comments on commit eaf9dc2

Please sign in to comment.